[jsinterp] Fixing set field
This commit is contained in:
parent
ee3dc29d05
commit
4e6f6893e0
@ -12,7 +12,7 @@ class Context(object):
|
|||||||
def __init__(self, variables=None, ended=False):
|
def __init__(self, variables=None, ended=False):
|
||||||
self.ended = ended
|
self.ended = ended
|
||||||
self.no_in = True
|
self.no_in = True
|
||||||
self.local_vars = {'this': {}}
|
self.local_vars = {}
|
||||||
if variables is not None:
|
if variables is not None:
|
||||||
for k, v in dict(variables).items():
|
for k, v in dict(variables).items():
|
||||||
# XXX validate identifiers
|
# XXX validate identifiers
|
||||||
@ -60,7 +60,7 @@ class JSInterpreter(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def this(self):
|
def this(self):
|
||||||
return self._context.local_vars['this']
|
return self._context.local_vars
|
||||||
|
|
||||||
def statements(self, code=None, pos=0, stack_size=100):
|
def statements(self, code=None, pos=0, stack_size=100):
|
||||||
if code is None:
|
if code is None:
|
||||||
@ -971,7 +971,7 @@ class JSInterpreter(object):
|
|||||||
elif name is Token.ID:
|
elif name is Token.ID:
|
||||||
# XXX error handling (unknown id)
|
# XXX error handling (unknown id)
|
||||||
ref = (self._context.local_vars[expr[1]] if expr[1] in self._context.local_vars else
|
ref = (self._context.local_vars[expr[1]] if expr[1] in self._context.local_vars else
|
||||||
self.this[expr[1]] if expr[1] in self.this else self.global_vars[expr[1]])
|
self.global_vars[expr[1]])
|
||||||
|
|
||||||
# literal
|
# literal
|
||||||
elif name in token_keys:
|
elif name in token_keys:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user