From fdcf19f8b1afeef5b412e712555584f0de0fee5d Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Tue, 15 Sep 2015 14:09:12 +0200 Subject: [PATCH] Document parser nodes that require execution for good static analysis. --- jedi/evaluate/analysis.py | 107 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/jedi/evaluate/analysis.py b/jedi/evaluate/analysis.py index 27b34a95..4ac36dfd 100644 --- a/jedi/evaluate/analysis.py +++ b/jedi/evaluate/analysis.py @@ -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