OILS / builtin / method_other.py View on Github | oilshell.org

32 lines, 16 significant
1"""Methods on various types"""
2
3from __future__ import print_function
4
5from _devbuild.gen.value_asdl import (value, value_t)
6
7from core import state
8from core import vm
9from frontend import typed_args
10from mycpp.mylib import log
11
12_ = log
13
14
15class 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