1 | """Methods on various types"""
|
2 |
|
3 | from __future__ import print_function
|
4 |
|
5 | from _devbuild.gen.value_asdl import (value, value_t)
|
6 |
|
7 | from core import state
|
8 | from core import vm
|
9 | from frontend import typed_args
|
10 | from mycpp.mylib import log
|
11 |
|
12 | _ = log
|
13 |
|
14 |
|
15 | class SetValue(vm._Callable):
|
16 |
|
17 | def __init__(self, mem):
|
18 | # type: (state.Mem) -> None
|
19 | self.mem = mem
|
20 |
|
21 | def Call(self, rd):
|
22 | # type: (typed_args.Reader) -> value_t
|
23 |
|
24 | # This is guaranteed
|
25 | place = rd.PosPlace()
|
26 |
|
27 | val = rd.PosValue()
|
28 | rd.Done()
|
29 |
|
30 | self.mem.SetPlace(place, val, rd.LeftParenToken())
|
31 |
|
32 | return value.Null
|