71 |
71 |
72 def visit_FunctionDef(self, node): |
72 def visit_FunctionDef(self, node): |
73 """ |
73 """ |
74 Public method defining a visitor for AST FunctionDef nodes. |
74 Public method defining a visitor for AST FunctionDef nodes. |
75 |
75 |
|
76 @param node reference to the node being inspected |
|
77 @type ast.FunctionDef |
|
78 """ |
|
79 self.__visitFunctionDefinition(node) |
|
80 |
|
81 def visit_AsyncFunctionDef(self, node): |
|
82 """ |
|
83 Public method defining a visitor for AST AsyncFunctionDef nodes. |
|
84 |
|
85 @param node reference to the node being inspected |
|
86 @type ast.AsyncFunctionDef |
|
87 """ |
|
88 self.__visitFunctionDefinition(node) |
|
89 |
|
90 def __visitFunctionDefinition(self, node): |
|
91 """ |
|
92 Private method defining a visitor for AST FunctionDef and |
|
93 AsyncFunctionDef nodes. |
|
94 |
76 Add relevant information about the node to the context for use in tests |
95 Add relevant information about the node to the context for use in tests |
77 which inspect function definitions. Add the function name to the |
96 which inspect function definitions. Add the function name to the |
78 current namespace for all descendants. |
97 current namespace for all descendants. |
79 |
98 |
80 @param node reference to the node being inspected |
99 @param node reference to the node being inspected |
81 @type ast.FunctionDef |
100 @type ast.FunctionDef, ast.AsyncFunctionDef |
82 """ |
101 """ |
83 self.__context['function'] = node |
102 self.__context['function'] = node |
84 qualname = SecurityUtils.namespacePathJoin(self.namespace, node.name) |
103 qualname = SecurityUtils.namespacePathJoin(self.namespace, node.name) |
85 name = qualname.split('.')[-1] |
104 name = qualname.split('.')[-1] |
86 self.__context['qualname'] = qualname |
105 self.__context['qualname'] = qualname |