Top Fields Constructors Methods
org.python.indexer.ast

public Class NFunctionDef

extends NNode
Class Inheritance
Known Direct Subclasses
org.python.indexer.ast.NLambda
Imports
org.python.indexer.Builtins, .Indexer, .NBinding, .Scope, org.python.indexer.types.NDictType, .NFuncType, .NListType, .NTupleType, .NType, .NUnknownType, java.util.ArrayList, .List

Field Summary

Modifier and TypeField and Description
public List<NNode>
public NNode
private List<NNode>
public List<NNode>
public NName
public NName
pack-priv static final long
public NName
Inherited from org.python.indexer.ast.NNode:
parent

Constructor Summary

AccessConstructor and Description
public
NFunctionDef(NName name, List<NNode> args, NBlock body, List<NNode> defaults, NName varargs, NName kwargs)

public
NFunctionDef(NName name, List<NNode> args, NBlock body, List<NNode> defaults, NName varargs, NName kwargs, int start, int end)

Method Summary

Modifier and TypeMethod and Description
protected NBinding
protected NBinding
protected void
bindFunctionDefaults(Scope s)

Processes any name-binding constructs appearing as parameter defaults.

protected void
protected void
protected void
protected void
bindNames(Scope s)

Overrides org.python.indexer.ast.NNode.bindNames.

Called by resolver to bind names into the passed scope.

private void
bindParamsToDefaults(NBinding selfBinding, NTupleType fromType)

public boolean
bindsName()

Overrides org.python.indexer.ast.NNode.bindsName.

Returns true if this is a name-binding node.

pack-priv static NType
getArgType(List<NNode> args, List<NNode> defaults, int argnum)

protected String
getBindingName(Scope s)

Returns the name of the function for indexing/qname purposes.

public List<NNode>
public boolean
public NType
resolve(Scope outer)

Overrides org.python.indexer.ast.NNode.resolve.

Node should set the resolved type in its type field and also return it.

public void
setDecoratorList(List<NNode> decoratorList)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
visit(NNodeVisitor
the object to call with this node. If the visitor returns true, the node also passes its children to the visitor.
v
)

Implements abstract org.python.indexer.ast.NNode.visit.

Visits this node and optionally its children.

Inherited from org.python.indexer.ast.NNode:
addChildrenaddChildrenaddErroraddErroraddTypeaddWarningaddWarningendgetAstRootgetDeepestNodeAtOffsetgetEnclosingNamespacegetFilegetParentgetTablegetTypeisCallisClassDefisLambdaisModuleisNamelengthresolveExprresolveListresolveListAsUnionsetEndsetParentsetStartsetTypestartvisitNodevisitNodeList

Field Detail

argsback to summary
public List<NNode> args
bodyback to summary
public NNode body
decoratorListback to summary
private List<NNode> decoratorList
defaultsback to summary
public List<NNode> defaults
kwargsback to summary
public NName kwargs
nameback to summary
public NName name
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides org.python.indexer.ast.NNode.serialVersionUID.

varargsback to summary
public NName varargs

Constructor Detail

NFunctionDefback to summary
public NFunctionDef(NName name, List<NNode> args, NBlock body, List<NNode> defaults, NName varargs, NName kwargs)
NFunctionDefback to summary
public NFunctionDef(NName name, List<NNode> args, NBlock body, List<NNode> defaults, NName varargs, NName kwargs, int start, int end)

Method Detail

addReadOnlyAttrback to summary
protected NBinding addReadOnlyAttr(String name, NType type, NBinding.Kind kind)
addSpecialAttrback to summary
protected NBinding addSpecialAttr(String name, NType atype, NBinding.Kind kind)
bindFunctionDefaultsback to summary
protected void bindFunctionDefaults(Scope s) throws Exception

Processes any name-binding constructs appearing as parameter defaults. For instance, in def foo(converter=lambda name: name.upper()): ... the lambda is a name-binding construct.

bindFunctionNameback to summary
protected void bindFunctionName(Scope owner) throws Exception
bindFunctionParamsback to summary
protected void bindFunctionParams(Scope funcTable) throws Exception
bindMethodAttrsback to summary
protected void bindMethodAttrs(Scope owner) throws Exception
bindNamesback to summary
protected void bindNames(Scope s) throws Exception

Overrides org.python.indexer.ast.NNode.bindNames.

Doc from org.python.indexer.ast.NNode.bindNames.

Called by resolver to bind names into the passed scope.

Annotations
@Override
bindParamsToDefaultsback to summary
private void bindParamsToDefaults(NBinding selfBinding, NTupleType fromType) throws Exception
bindsNameback to summary
public boolean bindsName()

Overrides org.python.indexer.ast.NNode.bindsName.

Doc from org.python.indexer.ast.NNode.bindsName.

Returns true if this is a name-binding node. Includes functions/lambdas, function/lambda params, classes, assignments, imports, and implicit assignment via for statements and except clauses.

Annotations
@Override
getArgTypeback to summary
pack-priv static NType getArgType(List<NNode> args, List<NNode> defaults, int argnum)
getBindingNameback to summary
protected String getBindingName(Scope s)

Returns the name of the function for indexing/qname purposes. Lambdas will return a generated name.

getDecoratorListback to summary
public List<NNode> getDecoratorList()
isFunctionDefback to summary
public boolean isFunctionDef()

Overrides org.python.indexer.ast.NNode.isFunctionDef.

Annotations
@Override
resolveback to summary
public NType resolve(Scope outer) throws Exception

Overrides org.python.indexer.ast.NNode.resolve.

Doc from org.python.indexer.ast.NNode.resolve.

Node should set the resolved type in its type field and also return it.

Annotations
@Override
setDecoratorListback to summary
public void setDecoratorList(List<NNode> decoratorList)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override

visitback to summary
public void visit(NNodeVisitor v)

Implements abstract org.python.indexer.ast.NNode.visit.

Doc from org.python.indexer.ast.NNode.visit.

Visits this node and optionally its children.

Parameters
v:NNodeVisitor

the object to call with this node. If the visitor returns true, the node also passes its children to the visitor.

Annotations
@Override