class documentation

An AST node visitor that keeps track of scopes and environments. A "scope" is the abstract namespace (represented by a string key that tracks the nested path of namespaces from the module root, e.g. module:class A:f). An "environment" holds data for the current scope. self.envs is not hierarchical, it's just a flat mapping of scope keys to environments.

Method __init__ Undocumented
Method add_scope Undocumented
Method enter_ClassDef Undocumented
Method enter_FunctionDef Undocumented
Method enter_Module Undocumented
Method get_id Construct an id based on node type.
Method iprint Print messages indented by scope level, for debugging.
Method leave If the node has introduced a new scope, we need to pop it off.
Method leave_ClassDef Undocumented
Method scope_id Undocumented
Instance Variable class_ids Undocumented
Instance Variable envs Undocumented
Instance Variable module_name Undocumented
Instance Variable stack Undocumented
Property current_class Undocumented
Property current_env Undocumented

Inherited from BaseVisitor:

Method enter Does a pre-order traversal of the AST.
Method generic_visit Called when no visit function is found for a node type.
Method visit Does a post-order traversal of the AST.
Method _call_visitor Undocumented
Method _children Children to recurse over.
Instance Variable _ast Undocumented
Instance Variable _node_children Undocumented
def __init__(self, ast, module_name, **kwargs): (source)
def add_scope(self, node, is_class=False): (source)

Undocumented

def enter_ClassDef(self, node): (source)

Undocumented

def enter_FunctionDef(self, node): (source)

Undocumented

def enter_Module(self, node): (source)

Undocumented

def get_id(self, node): (source)

Construct an id based on node type.

def iprint(self, x): (source)

Print messages indented by scope level, for debugging.

def leave(self, node): (source)

If the node has introduced a new scope, we need to pop it off.

def leave_ClassDef(self, _): (source)

Undocumented

def scope_id(self): (source)

Undocumented

class_ids: list = (source)

Undocumented

Undocumented

module_name = (source)

Undocumented

Undocumented

@property
current_class = (source)

Undocumented

@property
current_env = (source)

Undocumented