1
0
forked from VimPlug/jedi

Document parser nodes that require execution for good static analysis.

This commit is contained in:
Dave Halter
2015-09-15 14:09:12 +02:00
parent e7528198d3
commit fdcf19f8b1

View File

@@ -215,6 +215,113 @@ def get_executable_nodes(module):
Returns the nodes used in a module. All these nodes should be
evaluated to check for potential exceptions.
"""
"""
functions
to ignore:
------------ cared for:
global_stmt
exec_stmt
assert_stmt
compound_stmt
if_stmt
while_stmt
for_stmt
try_stmt
(except_clause)
with_stmt
(with_item)
(with_var)
yield_expr
file_input
funcdef
param
old_lambdef
lambdef
print_stmt
del_stmt
pass_stmt
flow_stmt
break_stmt
continue_stmt
return_stmt
raise_stmt
import_stmt
import_name
import_from
(import_as_name)
(dotted_as_name)
(import_as_names)
(dotted_as_names)
(dotted_name)
classdef
comp_for
(comp_if) ?
----------- add basic
test
or_test
and_test
not_test
expr
xor_expr
and_expr
shift_expr
arith_expr
term
factor
power
atom
comparison
expr_stmt
testlist
testlist1
testlist_safe
----------- special care:
# mostly depends on how we handle the other ones.
testlist_star_expr # should probably just work with expr_stmt
star_expr
exprlist # just ignore? then names are just resolved. Strange anyway, bc expr is not really allowed in the list, typically.
# always execute function arguments? -> no problem with stars.
arglist
argument
----------- ignore:
suite
subscriptlist
subscript
simple_stmt
?? sliceop # can probably just be added.
testlist_comp # prob ignore and care about it with atom.
dictorsetmaker
trailer
decorator
decorators
decorated
----------- remove:
tname # only exists in current Jedi parser. REMOVE!
tfpdef # python 2: tuple assignment; python 3: annotation
vfpdef # reduced in python 3 and therefore not existing.
tfplist # not in 3
vfplist # not in 3
--------- not existing with parser reductions.
small_stmt
stmt
comp_op
augassign
old_test
typedargslist # afaik becomes [param]
varargslist # dito
vname
comp_iter
"""
def check_children(node):
try:
children = node.children