Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

jsmain improvements

  • Loading branch information...
commit 7e6aab9f4840d722cac0958b8876e25ed2d53cf3 1 parent e6d01f0
@mattbasta authored
Showing with 10 additions and 10 deletions.
  1. +4 −1 appvalidator/testcases/javascript/nodedefinitions.py
  2. +6 −9 jsmain.py
View
5 appvalidator/testcases/javascript/nodedefinitions.py
@@ -81,7 +81,10 @@ def wrap(traverser, node):
func()
# Put the function off for traversal at the end of the current block scope.
- traverser.function_collection[-1].append(lambda: wrap(traverser, node))
+ if traverser.function_collection:
+ traverser.function_collection[-1].append(lambda: wrap(traverser, node))
+ else:
+ wrap(traverser, node)
return JSObject(traverser=traverser, callable_=True)
View
15 jsmain.py
@@ -25,24 +25,21 @@
trav = appvalidator.testcases.javascript.traverser.Traverser(err, "stdin")
trav._push_context()
+ def do_callable(wrapper, arguments, traverser):
+ for arg in arguments:
+ print arg, arg.callable
+
def do_inspect(wrapper, arguments, traverser):
print "~" * 50
for arg in arguments:
- if arg["type"] == "Identifier":
- print 'Identifier: "%s"' % arg["name"]
- else:
- print arg["type"]
-
- a = traverser.traverse_node(arg)
- print a.output()
- print "Context: %s" % a.context
- print "<"
+ print arg.output()
print "~" * 50
def do_exit(wrapper, arguments, traverser):
print "Goodbye!"
sys.exit()
+ GLOBAL_ENTITIES[u"callable"] = {"return": do_callable}
GLOBAL_ENTITIES[u"inspect"] = {"return": do_inspect}
GLOBAL_ENTITIES[u"exit"] = {"return": do_exit}
Please sign in to comment.
Something went wrong with that request. Please try again.