Method Summary |
|
__init__ (self,
session,
filename,
module_name)
Initialise the visitor with an optional 'session', 'filename', and an
optional 'module_name'. |
|
attach_error (self,
node,
error_name,
handler)
Attach an annotation to 'node' indicating that an error of the given
'error_name' may be raised, using the given 'handler' to locate the named
class. |
|
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'. |
|
dispatch (self,
node,
*args)
Dispatch to the handler method for 'node', providing the additional
'args'. |
|
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,
locals)
Add entries to the given 'modified_locals' dictionary by examining the
'locals'. |
|
merge_undefined (self,
modified_locals,
locals)
Add undefined values for all entries in the given 'modified_locals'
not found in the given 'locals'. |
|
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,
strict)
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,
modified_filtered_locals)
Process the conditional 'block' using the given 'handler'. |
|
process_specialisation (self,
caller,
specialisation,
function,
locals,
handler)
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. |
|
process_unary_operator (self,
operator,
handler)
Process the given 'operator' node using the given 'handler'. |
|
reset_specialisations (self,
caller)
For the given 'caller', reset the specialisations associated with that
node. |
|
run_specialisation(self,
specialisation,
function,
handler)
|
|
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'. |
|
visitAugAssign (self,
augassign,
handler)
Process the given 'augassign' 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'. |
|
visitPrint (self,
print_,
handler)
Process the given 'print_' node using the given 'handler'. |
|
visitPrintnl (self,
print_,
handler)
Process the given 'print_' 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'. |
Inherited from ASTVisitor |
|
preorder (self,
tree,
visitor,
*args)
Do preorder walk of tree using visitor |