public class FunctionNode extends BaseTypedDefinitionNode implements IFunctionNode
| Modifier and Type | Field and Description |
|---|---|
protected IFunctionContentsPart |
contentsPart
Contents of the function, including args, etc
|
typeNode, typeOperatorStartdefinition, nameNodeemptyNodeArray, parentUNKNOWN| Constructor and Description |
|---|
FunctionNode(IASToken functionKeyword,
IdentifierNode nameNode)
Constructor.
|
FunctionNode(IdentifierNode node,
IFunctionContentsPart part)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
analyze(EnumSet<PostProcessStep> set,
ASScope scope,
Collection<ICompilerProblem> problems) |
protected boolean |
buildInnerString(StringBuilder sb)
For debugging only.
|
boolean |
containsLocalFunctions()
Does this function have a local functions within
|
protected IFunctionContentsPart |
createContentsPart() |
protected FunctionDefinition |
createFunctionDefinition(String name)
Method to create the correct Definition class - needed so we can create
different Definition types for getters, setters, and plain old functions
|
void |
discardFunctionBody()
Delete all children nodes in a function body.
|
INamespaceDecorationNode |
getActualNamespaceNode()
Get the real namespace node, or null if there isn't one.
|
FunctionDefinition |
getDefinition() |
boolean |
getEmittingLocalFunctions()
flag to determine whether to emit the local function
or a reference to it
|
IFunctionDefinition.FunctionClassification |
getFunctionClassification()
Get the classification for this function (local, argument, class member,
etc)
|
KeywordNode |
getFunctionKeywordNode()
Get the function keyword
|
protected int |
getInitialChildCount()
Take a guess as to an efficient initial child count.
|
List<IFunctionNode> |
getLocalFunctions()
Get local functions within
|
String |
getNamespace()
Returns the namespace that this member belongs to
|
INamespaceDecorationNode |
getNamespaceNode() |
ASTNodeID |
getNodeID()
Get the opcode of this node
|
IParameterNode[] |
getParameterNodes()
Get the parameters of this function as an array of
IParameterNode
elements |
ContainerNode |
getParametersContainerNode()
Returns the container for parameters of this function
|
Collection<ICompilerProblem> |
getParsingProblems()
Get any saved parsing problems from lazily parsing the function body.
|
String |
getQualifiedName()
Get the qualified name of this type
|
String |
getReturnType()
Returns the type of this function as it exist in source.
|
IExpressionNode |
getReturnTypeNode()
Returns the
IExpressionNode that corresponds to the return type
node of this IFunctionNode |
ScopedBlockNode |
getScopedNode()
Returns the scope that is contained with this definition.
|
String |
getShortName()
Get the short name of this type (without any package information)
|
int |
getSpanningStart()
Gets the local offset where the node starts, including any extra items that may
change the appearance of the node's start.
|
boolean |
hasBeenParsed() |
boolean |
hasBody()
Does this function have a non-empty body
|
boolean |
hasNamespace(String namespace)
Is the given namespace present on this definition?
|
protected void |
init(ExpressionNodeBase idNode) |
boolean |
isCastFunction()
Is this a cast function?
|
boolean |
isConstructor()
Is this a constructor?
|
boolean |
isConstructorOf(ClassNode classNode)
Is this a constructor of the specified class (assumes that this function
definition is actually located in the body of the specified class)
|
boolean |
isGetter()
Is this function a getter?
|
boolean |
isImplicit()
Is this definition an implicit definition that doesn't actually appear in
the source file?
|
boolean |
isPackageLevelFunction()
Determine whether this is a package-level function (i.e. a function
defined in a package, as opposed to a class or some other scope)
|
boolean |
isSetter()
Is this function a setter?
|
void |
normalize(boolean fillInOffsets)
Normalize the tree.
|
void |
parseFunctionBody(Collection<ICompilerProblem> problems)
Build AST for the function body from the buffered function body text.
|
void |
rememberLocalFunction(IFunctionNode value)
Remember local Functions in this function node().
|
protected void |
setChildren(boolean fillInOffsets)
If this node has custom children (names, arguments, etc), shove them into
the list of children.
|
protected void |
setDefinition(IDefinition def) |
void |
setEmittingLocalFunctions(boolean emit)
flag to determine whether to emit the local function
or a reference to it
|
void |
setFunctionBodyInfo(ASToken openT,
ASToken lastTokenInBody,
ConfigProcessor configProcessor,
StringBuilder bodyCache)
Store the function body text on the function node so that the AST nodes
can be rebuilt later.
|
buildBindableGetter, buildBindableSetter, fillinDefinition, getTypeName, getTypeNode, getTypeOperatorEnd, getTypeOperatorStart, hasExplicitType, hasTypeOperator, isAnyType, isVoidType, setTypeaddDecorationChildren, addModifier, createDecorationPart, fillInMetadata, fillInModifiers, fillInNamespaceAndModifiers, getASDocComment, getDecorationPart, getMetaInfos, getMetaTags, getMetaTagsNode, getModifiers, getModifiersContainer, getName, getNameAbsoluteEnd, getNameAbsoluteStart, getNameEnd, getNameExpressionNode, getNameStart, getNodeStartForTooling, hasExplicitComment, hasModifier, setASDocComment, setMetaTags, setModifiersContainer, setNamespaceaddChild, addChild, addChildInOrder, addChildPostNormalize, addTemporaryChild, getChild, getChildCount, optimizeChildren, removeAllChildren, removeChild, removeTemporaryChild, replaceChild, sortChildren, swapChildrenbuildStringRecursive, canContinueContainmentSearch, collectImportNodes, combineAttributes, connectedToProjectScope, contains, endAfter, endAfter, endBefore, endBefore, fillInOffsets, getAbsoluteEnd, getAbsoluteStart, getAncestorOfType, getASScope, getContainingFilePath, getContainingNode, getContainingScope, getEnd, getFileScope, getFileSpecification, getInnerString, getNodeKind, getPackageName, getParent, getScopeNode, getStart, getSucceedingNode, getWorkspace, isTerminal, isTransparent, looselyContains, runPostProcess, setParent, span, span, span, startAfter, startAfter, startBefore, startBefore, toString, tryGetOffsetLookup, verifygetColumn, getEndColumn, getEndLine, getLine, getLineColumnString, getOffsetsString, getSourcePath, getSourcePathString, setColumn, setEnd, setEndColumn, setEndLine, setLine, setSourceLocation, setSourcePath, setStart, span, spanclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetASDocComment, hasExplicitCommentgetContainingFilePath, getMetaInfos, getMetaTags, getName, getNameAbsoluteEnd, getNameAbsoluteStart, getNameEnd, getNameExpressionNode, getNameStart, getPackageName, hasModifiercontains, getAncestorOfType, getChild, getChildCount, getContainingNode, getContainingScope, getFileSpecification, getParent, getSucceedingNode, isTerminalgetAbsoluteEnd, getAbsoluteStart, getColumn, getEnd, getEndColumn, getEndLine, getLine, getSourcePath, getStartprotected IFunctionContentsPart contentsPart
public FunctionNode(IASToken functionKeyword, IdentifierNode nameNode)
Creates a FunctionNode from the "new" keyword token and the
function name node.
functionKeyword - function keywordnameNode - node containing the name of this functionpublic FunctionNode(IdentifierNode node, IFunctionContentsPart part)
Creates a new FunctionNode with a custom part for this functions contents.
node - the name of the nodepart - the IFunctionContentsPartpublic ASTNodeID getNodeID()
IASNodepublic int getSpanningStart()
IASNodegetSpanningStart in interface IASNodegetSpanningStart in class BaseDefinitionNodeprotected void setChildren(boolean fillInOffsets)
NodeBasesetChildren in class NodeBasepublic void normalize(boolean fillInOffsets)
NodeBasenormalize in class BaseDefinitionNodeprotected void analyze(EnumSet<PostProcessStep> set, ASScope scope, Collection<ICompilerProblem> problems)
analyze in class BaseDefinitionNodeprotected boolean buildInnerString(StringBuilder sb)
NodeBasebuildOuterString().
It is overridden by subclasses to display optional node-specific
information in the middle of the string, between the node type and the
location information.buildInnerString in class NodeBaseprotected int getInitialChildCount()
TreeNodegetInitialChildCount in class TreeNodeprotected void init(ExpressionNodeBase idNode)
init in class BaseTypedDefinitionNodepublic INamespaceDecorationNode getNamespaceNode()
getNamespaceNode in class BaseDefinitionNodepublic String getNamespace()
IDefinitionNodegetNamespace in interface IDefinitionNodegetNamespace in class BaseDefinitionNodepublic boolean hasNamespace(String namespace)
IDefinitionNodehasNamespace in interface IDefinitionNodehasNamespace in class BaseDefinitionNodenamespace - the namespace to check forpublic FunctionDefinition getDefinition()
getDefinition in interface IDefinitionNodegetDefinition in interface IFunctionNodegetDefinition in class BaseDefinitionNodeprotected void setDefinition(IDefinition def)
setDefinition in class BaseDefinitionNodepublic boolean isImplicit()
IDefinitionNodethis, super,
default constructors, and cast functions.isImplicit in interface IDefinitionNodepublic String getQualifiedName()
IDefinitionNodegetQualifiedName in interface IDefinitionNodepublic String getShortName()
IDefinitionNodegetShortName in interface IDefinitionNodepublic final ScopedBlockNode getScopedNode()
IScopedDefinitionNodegetScopedNode in interface IScopedDefinitionNodeIDefinitionNodepublic IFunctionDefinition.FunctionClassification getFunctionClassification()
IFunctionNodegetFunctionClassification in interface IFunctionNodepublic boolean isGetter()
IFunctionNodeisGetter in interface IFunctionNodepublic boolean isSetter()
IFunctionNodeisSetter in interface IFunctionNodepublic boolean isConstructor()
IFunctionNodeisConstructor in interface IFunctionNodepublic boolean isCastFunction()
IFunctionNodeisCastFunction in interface IFunctionNodepublic ContainerNode getParametersContainerNode()
IFunctionNodegetParametersContainerNode in interface IFunctionNodepublic IParameterNode[] getParameterNodes()
IFunctionNodeIParameterNode
elementsgetParameterNodes in interface IFunctionNodepublic IExpressionNode getReturnTypeNode()
IFunctionNodeIExpressionNode that corresponds to the return type
node of this IFunctionNodegetReturnTypeNode in interface IFunctionNodeIExpressionNode or nullpublic String getReturnType()
IFunctionNodevoid is returnedgetReturnType in interface IFunctionNodepublic boolean hasBody()
IFunctionNodehasBody in interface IFunctionNodeprotected IFunctionContentsPart createContentsPart()
protected FunctionDefinition createFunctionDefinition(String name)
public KeywordNode getFunctionKeywordNode()
public boolean isPackageLevelFunction()
public INamespaceDecorationNode getActualNamespaceNode()
public boolean isConstructorOf(ClassNode classNode)
public Collection<ICompilerProblem> getParsingProblems()
public final void parseFunctionBody(Collection<ICompilerProblem> problems)
Make sure PostProcessStep.POPULATE_SCOPE has been applied to the
containing FileNode This method always populate scopes of the
rebuilt function node. If the scopes for the containing nodes weren't
initialized, the rebuilt scopes can attach itself to it's parent.
public final void discardFunctionBody()
public final boolean hasBeenParsed()
public final void setFunctionBodyInfo(ASToken openT, ASToken lastTokenInBody, ConfigProcessor configProcessor, StringBuilder bodyCache)
public List<IFunctionNode> getLocalFunctions()
IFunctionNodegetLocalFunctions in interface IFunctionNodepublic boolean containsLocalFunctions()
IFunctionNodecontainsLocalFunctions in interface IFunctionNodepublic void rememberLocalFunction(IFunctionNode value)
IFunctionNoderememberLocalFunction in interface IFunctionNodepublic boolean getEmittingLocalFunctions()
IFunctionNodegetEmittingLocalFunctions in interface IFunctionNodepublic void setEmittingLocalFunctions(boolean emit)
IFunctionNodesetEmittingLocalFunctions in interface IFunctionNodeCopyright © 2016 The Apache Software Foundation. All rights reserved.