Updated JS shell for better debugging; Removed debug code
s
This commit is contained in:
Родитель
a94d1a5fbd
Коммит
fa03d46694
22
jsmain.py
22
jsmain.py
|
@ -21,6 +21,28 @@ if __name__ == '__main__':
|
|||
trav._push_context()
|
||||
while True:
|
||||
line = sys.stdin.readline()
|
||||
|
||||
if line == "enable bootstrap\n":
|
||||
err.save_resource("em:bootstrap", True)
|
||||
continue
|
||||
elif line == "disable bootstrap\n":
|
||||
err.save_resource("em:bootstrap", False)
|
||||
continue
|
||||
elif line.startswith(("inspect ", "isglobal ")):
|
||||
actions = {"inspect": lambda wrap: wrap.value if
|
||||
wrap.is_global else
|
||||
wrap.output(),
|
||||
"isglobal": lambda wrap: wrap.is_global}
|
||||
vars = line.split()
|
||||
final_context = trav.contexts[-1]
|
||||
for var in vars[1:]:
|
||||
if var not in final_context.data:
|
||||
print "%s not found." % var
|
||||
continue
|
||||
wrap = final_context.data[var]
|
||||
print actions[vars[0]](wrap)
|
||||
continue
|
||||
|
||||
tree = spidermonkey.get_tree(line, err)
|
||||
if tree is None:
|
||||
continue
|
||||
|
|
|
@ -179,7 +179,6 @@ class JSWrapper(object):
|
|||
value = self.value
|
||||
dirty = value is None
|
||||
if self.is_global:
|
||||
print "Getting %s" % name
|
||||
if "value" not in value:
|
||||
output = JSWrapper(traverser=traverser)
|
||||
output.value = {}
|
||||
|
@ -199,10 +198,8 @@ class JSWrapper(object):
|
|||
else:
|
||||
return node
|
||||
|
||||
print "Prelambdas:", value["value"]
|
||||
value_val = value["value"]
|
||||
value_val = _evaluate_lambdas(value_val)
|
||||
print "Postlambdas:", value_val
|
||||
|
||||
if isinstance(value_val, dict):
|
||||
if name in value_val:
|
||||
|
|
Загрузка…
Ссылка в новой задаче