public class NFunctionDef extends NNode
Modifier and Type | Field and Description |
---|---|
java.util.List<NNode> |
args |
NNode |
body |
java.util.List<NNode> |
defaults |
NName |
kwargs |
NName |
name |
NName |
varargs |
Constructor and Description |
---|
NFunctionDef(NName name,
java.util.List<NNode> args,
NBlock body,
java.util.List<NNode> defaults,
NName varargs,
NName kwargs) |
NFunctionDef(NName name,
java.util.List<NNode> args,
NBlock body,
java.util.List<NNode> defaults,
NName varargs,
NName kwargs,
int start,
int end) |
Modifier and Type | Method and Description |
---|---|
protected NBinding |
addReadOnlyAttr(java.lang.String name,
NType type,
NBinding.Kind kind) |
protected NBinding |
addSpecialAttr(java.lang.String name,
NType atype,
NBinding.Kind kind) |
protected void |
bindFunctionDefaults(Scope s)
Processes any name-binding constructs appearing as parameter defaults.
|
protected void |
bindFunctionName(Scope owner) |
protected void |
bindFunctionParams(Scope funcTable) |
protected void |
bindMethodAttrs(Scope owner) |
protected void |
bindNames(Scope s)
Called by resolver to bind names into the passed scope.
|
boolean |
bindsName()
Returns
true if this is a name-binding node. |
protected java.lang.String |
getBindingName(Scope s)
Returns the name of the function for indexing/qname purposes.
|
java.util.List<NNode> |
getDecoratorList() |
boolean |
isFunctionDef() |
NType |
resolve(Scope outer)
Node should set the resolved type in its
NNode.type field
and also return it. |
void |
setDecoratorList(java.util.List<NNode> decoratorList) |
java.lang.String |
toString() |
void |
visit(NNodeVisitor v)
Visits this node and optionally its children.
|
addChildren, addChildren, addError, addError, addType, addWarning, addWarning, end, getAstRoot, getDeepestNodeAtOffset, getEnclosingNamespace, getFile, getParent, getTable, getType, isCall, isClassDef, isLambda, isModule, isName, length, resolveExpr, resolveList, resolveListAsUnion, setEnd, setParent, setStart, setType, start, visitNode, visitNodeList
public NName name
public java.util.List<NNode> args
public java.util.List<NNode> defaults
public NName varargs
public NName kwargs
public NNode body
public NFunctionDef(NName name, java.util.List<NNode> args, NBlock body, java.util.List<NNode> defaults, NName varargs, NName kwargs)
public void setDecoratorList(java.util.List<NNode> decoratorList)
public java.util.List<NNode> getDecoratorList()
public boolean isFunctionDef()
isFunctionDef
in class NNode
public boolean bindsName()
NNode
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.protected java.lang.String getBindingName(Scope s)
protected void bindNames(Scope s) throws java.lang.Exception
NNode
protected void bindFunctionName(Scope owner) throws java.lang.Exception
java.lang.Exception
protected void bindFunctionParams(Scope funcTable) throws java.lang.Exception
java.lang.Exception
protected void bindFunctionDefaults(Scope s) throws java.lang.Exception
def foo(converter=lambda name: name.upper()): ...
the lambda is a name-binding construct.java.lang.Exception
protected void bindMethodAttrs(Scope owner) throws java.lang.Exception
java.lang.Exception
protected NBinding addSpecialAttr(java.lang.String name, NType atype, NBinding.Kind kind)
protected NBinding addReadOnlyAttr(java.lang.String name, NType type, NBinding.Kind kind)
public NType resolve(Scope outer) throws java.lang.Exception
NNode
NNode.type
field
and also return it.public java.lang.String toString()
toString
in class java.lang.Object
public void visit(NNodeVisitor v)
NNode