Package analysis :: Module source :: Class AnalysisVisitor
[show private | hide private]
[frames | no frames]

Class AnalysisVisitor

ASTVisitor --+
             |
            AnalysisVisitor


Method Summary
  __init__(self, session, module_name, debug)
Initialise the visitor with an optional 'session' and an optional 'module_name'.
  attach_iteration(self, node, arg, refcontext, handler)
On the given 'node', attach access to the __iter__ method of the given 'arg', using the 'refcontext' to indicate the meaning of the reference, as well as the 'handler'.
  attach_next_iteration(self, node, arg, handler)
On the given 'node', attach a call to the next method of an iterator found on the given 'arg', using the given 'handler'.
  attach_true(self, node, arg, refcontext, handler)
On the given 'node', attach invocations of the __true__ method for the given 'arg', defining 'refcontext' for the invocations, and using the given 'handler'.
  call_specialisation(self, caller, method, args, refcontext, handler, star_args, dstar_args)
On the given 'caller' node, invoke the given 'method' with the given 'args', using the specified 'refcontext' to define the meaning of any references involved and the 'handler' to provide namespace information.
  default(self, node, handler)
Handle a 'node' not explicitly handled elsewhere, using the given namespace 'handler'.
  depth_first(self, node, handler, right_to_left)
Traverse the children of the given 'node', using the given 'handler'.
  get_const_ref(self, const, definition)
Get the reference to a constant using the given 'const' node and the 'definition' of the constant type as found in the built-in types.
  get_context_args(self, node, obj)
For the given 'node', add the self argument as defined by 'obj'.
  make_const(self, instantiator, value)
Make a new constant for use by the 'instantiator', having the given 'value'.
  merge_locals(self, modified_locals, new_handler)
Add entries to the given 'modified_locals' dictionary by examining the locals found in the 'new_handler'.
  optimise_specialisation(self, caller, method, args, handler)
Using the given 'caller' node, 'method' node, 'args' and namespace 'handler' determine whether the call can be optimised at compile time, returning a true value and linking the 'caller' appropriately to the optimised result value if possible; otherwise, a false value is returned.
  process_binary_operator(self, operator, handler)
Process the given 'operator' node using the given 'handler'.
  process_block(self, node, handler)
Process the 'node' with the given namespace 'handler' for a block of code.
  process_conditional(self, block, handler, modified_locals)
Process the conditional 'block' using the given 'handler'.
  reset_specialisations(self, caller)
For the given 'caller', reset the specialisations associated with that node.
  run_specialisation(self, specialisation, function, locals, handler)
  specialise_function(self, function, locals, handler, add_to_module)
Process the given 'function' node using the given 'locals' namespace and the given 'handler', producing a specialised version of the function and returning a node for that specialisation.
  visitAnd(self, and_, handler)
Process the given 'and_' node using the given 'handler'.
  visitAssAttr(self, assattr, handler)
Process the given 'assattr' node using the given 'handler'.
  visitAssign(self, assign, handler)
Process the given 'assign' node using the given 'handler'.
  visitAssName(self, assname, handler)
Process the given 'assname' node using the given 'handler'.
  visitAssTuple(self, asstuple, handler)
Process the given 'asstuple' node using the given 'handler'.
  visitCallFunc(self, callfunc, handler)
Process the given 'callfunc' node using the given 'handler'.
  visitClass(self, class_, handler)
Process the given 'class_' node using the given 'handler'.
  visitCompare(self, compare, handler)
Process the given 'compare' node using the given 'handler'.
  visitConst(self, const, handler)
Process the given 'const' node using the given 'handler'.
  visitFor(self, for_, handler)
Process the given 'for_' node using the given 'handler'.
  visitFunction(self, function, handler)
  visitGetattr(self, getattr, handler)
Process the given 'getattr' node using the given 'handler'.
  visitGlobal(self, global_, handler)
  visitIf(self, if_, handler)
Process the given 'if_' node using the given 'handler'.
  visitImport(self, import_, handler)
Process the given 'import_' node using the given 'handler'.
  visitList(self, list, handler)
Process the given 'list' node using the given 'handler'.
  visitModule(self, module, handler)
Process the given 'module' node with the optional 'builtins' dictionary.
  visitName(self, name, handler)
Process the given 'name' node using the given 'handler'.
  visitNot(self, not_, handler)
Process the given 'not_' node using the given 'handler'.
  visitOr(self, or_, handler)
Process the given 'or_' node using the given 'handler'.
  visitReturn(self, return_, handler)
Process the given 'return_' node using the given 'handler'.
  visitSlice(self, slice, handler)
Process the given 'slice' node using the given 'handler'.
  visitStmt(self, stmt, handler)
Process the given 'stmt' node using the given 'handler'.
  visitSubscript(self, subscript, handler)
Process the given 'subscript' node using the given 'handler'.
  visitTuple(self, tuple, handler)
Process the given 'tuple' node using the given 'handler'.
  visitWhile(self, while_, handler)
Process the given 'while_' node using the given 'handler'.
  _process_binary_operator(self, node, left, right, left_method_name, right_method_name, handler)
Process the binary operator 'node', with the given 'left' and 'right' hand side arguments, the specified 'left_method_name' and 'right_method_name', and the given 'handler'.
    Inherited from ASTVisitor
  dispatch(self, node, *args)
  preorder(self, tree, visitor, *args)
Do preorder walk of tree using visitor

Class Variable Summary
    Inherited from ASTVisitor
int VERBOSE = 0                                                                     

Method Details

__init__(self, session=None, module_name=None, debug=0)
(Constructor)

Initialise the visitor with an optional 'session' and an optional 'module_name'.
Overrides:
compiler.visitor.ASTVisitor.__init__

attach_iteration(self, node, arg, refcontext, handler)

On the given 'node', attach access to the __iter__ method of the given 'arg', using the 'refcontext' to indicate the meaning of the reference, as well as the 'handler'.

attach_next_iteration(self, node, arg, handler)

On the given 'node', attach a call to the next method of an iterator found on the given 'arg', using the given 'handler'.

attach_true(self, node, arg, refcontext, handler)

On the given 'node', attach invocations of the __true__ method for the given 'arg', defining 'refcontext' for the invocations, and using the given 'handler'.

call_specialisation(self, caller, method, args, refcontext, handler, star_args=None, dstar_args=None)

On the given 'caller' node, invoke the given 'method' with the given 'args', using the specified 'refcontext' to define the meaning of any references involved and the 'handler' to provide namespace information. The optional 'star_args' and 'dstar_args' may be used to provide additional argument information.

Establish the special _targets attribute on 'caller', and link results to that node.

default(self, node, handler)

Handle a 'node' not explicitly handled elsewhere, using the given namespace 'handler'.
Overrides:
compiler.visitor.ASTVisitor.default

depth_first(self, node, handler, right_to_left=0)

Traverse the children of the given 'node', using the given 'handler'. If the optional 'right_to_left' flag is set, traverse the children in reverse order.

See also visitStmt which also traverses child nodes.

get_const_ref(self, const, definition)

Get the reference to a constant using the given 'const' node and the 'definition' of the constant type as found in the built-in types.

get_context_args(self, node, obj)

For the given 'node', add the self argument as defined by 'obj'.

make_const(self, instantiator, value)

Make a new constant for use by the 'instantiator', having the given 'value'.

merge_locals(self, modified_locals, new_handler)

Add entries to the given 'modified_locals' dictionary by examining the locals found in the 'new_handler'.

optimise_specialisation(self, caller, method, args, handler)

Using the given 'caller' node, 'method' node, 'args' and namespace 'handler' determine whether the call can be optimised at compile time, returning a true value and linking the 'caller' appropriately to the optimised result value if possible; otherwise, a false value is returned.

process_binary_operator(self, operator, handler)

Process the given 'operator' node using the given 'handler'.

process_block(self, node, handler)

Process the 'node' with the given namespace 'handler' for a block of code.

process_conditional(self, block, handler, modified_locals)

Process the conditional 'block' using the given 'handler'. Store modifications to the namespace in the 'modified_locals' dictionary.

reset_specialisations(self, caller)

For the given 'caller', reset the specialisations associated with that node.

specialise_function(self, function, locals, handler, add_to_module=1)

Process the given 'function' node using the given 'locals' namespace and the given 'handler', producing a specialised version of the function and returning a node for that specialisation.

If the optional 'add_to_module' parameter is set to true, add the specialisation as a sibling of the original 'function' in the module.

visitAnd(self, and_, handler)

Process the given 'and_' node using the given 'handler'.

visitAssAttr(self, assattr, handler)

Process the given 'assattr' node using the given 'handler'.

visitAssign(self, assign, handler)

Process the given 'assign' node using the given 'handler'.

visitAssName(self, assname, handler)

Process the given 'assname' node using the given 'handler'.

visitAssTuple(self, asstuple, handler)

Process the given 'asstuple' node using the given 'handler'.

visitCallFunc(self, callfunc, handler)

Process the given 'callfunc' node using the given 'handler'.

visitClass(self, class_, handler)

Process the given 'class_' node using the given 'handler'.

visitCompare(self, compare, handler)

Process the given 'compare' node using the given 'handler'.

visitConst(self, const, handler)

Process the given 'const' node using the given 'handler'.

visitFor(self, for_, handler)

Process the given 'for_' node using the given 'handler'.

visitGetattr(self, getattr, handler)

Process the given 'getattr' node using the given 'handler'.

visitIf(self, if_, handler)

Process the given 'if_' node using the given 'handler'.

visitImport(self, import_, handler)

Process the given 'import_' node using the given 'handler'.

visitList(self, list, handler)

Process the given 'list' node using the given 'handler'.

visitModule(self, module, handler=None)

Process the given 'module' node with the optional 'builtins' dictionary. If 'builtins' is not specified, combine the globals and built-ins in the processed module. If the optional 'module_name' is specified, names defined in this module will be suitably qualified by this information.

visitName(self, name, handler)

Process the given 'name' node using the given 'handler'.

visitNot(self, not_, handler)

Process the given 'not_' node using the given 'handler'.

visitOr(self, or_, handler)

Process the given 'or_' node using the given 'handler'.

visitReturn(self, return_, handler)

Process the given 'return_' node using the given 'handler'.

visitSlice(self, slice, handler)

Process the given 'slice' node using the given 'handler'.

visitStmt(self, stmt, handler)

Process the given 'stmt' node using the given 'handler'.

visitSubscript(self, subscript, handler)

Process the given 'subscript' node using the given 'handler'.

visitTuple(self, tuple, handler)

Process the given 'tuple' node using the given 'handler'.

visitWhile(self, while_, handler)

Process the given 'while_' node using the given 'handler'.

_process_binary_operator(self, node, left, right, left_method_name, right_method_name, handler)

Process the binary operator 'node', with the given 'left' and 'right' hand side arguments, the specified 'left_method_name' and 'right_method_name', and the given 'handler'.

Generated by Epydoc 2.1 on Tue Dec 20 00:05:45 2005 http://epydoc.sf.net