public class FunctionDefinition extends ScopedDefinitionBase implements IFunctionDefinition
After a function definition is in the symbol table, it should always be
accessed through the read-only IFunctionDefinition interface.
IFunctionDefinition.FunctionClassificationFLAG_CAST_FUNCTION, FLAG_CONSTRUCTOR, FLAG_CONTINGENT, FLAG_DECLARED_IN_CONTROL_FLOW, FLAG_DEFAULT, FLAG_DEPRECATED, FLAG_DYNAMIC, FLAG_FINAL, FLAG_GENERATED_EMBED_CLASS, FLAG_HAS_INIT, FLAG_IMPLICIT, FLAG_NATIVE, FLAG_OVERRIDE, FLAG_REST, FLAG_STATIC, flags, nodeRef, singletonEmptyMetaTags| Constructor and Description |
|---|
FunctionDefinition(String name) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildInnerString(StringBuilder sb)
For debugging only.
|
protected boolean |
canFunctionBeInlined() |
IFunctionDefinition.FunctionClassification |
getFunctionClassification()
Get the classification for this function (local, argument, class member,
etc)
|
IFunctionNode |
getFunctionNode()
Returns the
IFunctionNode from which this definition was created,
if the definition came from the AST for a source file. |
ParameterDefinition[] |
getParameters()
Get the parameters of this function as an array of
IParameterDefinition elements |
String |
getReturnTypeAsDisplayString()
Converts this definition's
IReference for its return type
to a human-readable String. |
IReference |
getReturnTypeReference()
Gets a reference to the return type for this function.
|
boolean |
hasCompatibleSignature(IFunctionDefinition other,
ICompilerProject project) |
boolean |
hasRequiredParameters()
Returns
true if the function has required parameters. |
boolean |
inlineFunction()
Can this function be inlined
|
boolean |
isCastFunction()
Is this a cast function?
|
boolean |
isConstructor()
Is this a constructor?
|
boolean |
isImplementation(ICompilerProject project)
Determines whether this function is an implementation of a function from
an implements Interface
|
boolean |
isInline()
Is this function marked as
inline? |
boolean |
isTopLevelDefinition()
Is this definition a toplevel definition - constructors are special,
which is why this is overriden here
|
boolean |
matches(DefinitionBase definition) |
boolean |
overridesAncestor(ICompilerProject project)
Is this function actually overriding a function in a base class
|
IFunctionDefinition |
resolveImplementedFunction(ICompilerProject project)
Finds the definition of the IFunctionDefinition that defines this
function
|
FunctionDefinition |
resolveOverriddenFunction(ICompilerProject project)
Finds the definition of the IFunctionDefinition that we are overriding
|
List<IFunctionDefinition> |
resolveOverridenInterfaceFunctions(ICompilerProject project)
Return a list of FunctionDefinitions from the base interfaces that this FunctionDefinition overrides.
|
ITypeDefinition |
resolveReturnType(ICompilerProject project)
Resolve this function's return type in the given scope and find its
definition
|
void |
setAsConstructor(ClassDefinition classDef) |
void |
setCastFunction() |
void |
setNode(IDefinitionNode node)
Attaches a weak reference to the source node that produced this
definition, and copies over enough source-location information to
re-associate the node if it is garbage-collected.
|
void |
setParameters(ParameterDefinition[] value) |
void |
setReturnTypeReference(IReference returnTypeReference)
Sets a reference to the return type for this function.
|
getContainedScope, setContainedScope, verifyaddMetaTag, buildString, getAbsoluteEnd, getAbsoluteStart, getAllMetaTags, getAncestorOfType, getArrayElementType, getBaseName, getBindableEventNames, getColumn, getContainingASScope, getContainingFilePath, getContainingScope, getContainingSourceFilePath, getDefinition, getDeprecationInfo, getEnd, getExplicitSourceComment, getFileScope, getFileSpecification, getInstanceType, getLine, getLocationString, getMaxSize, getMetaTagByName, getMetaTagsByName, getMName, getModifiers, getNameColumn, getNameEnd, getNameLine, getNamespaceReference, getNamespaceReferenceAsString, getNameStart, getNode, getPackageName, getParent, getPercentProxy, getQualifiedName, getSize, getSkinPart, getSourcePath, getStart, getStorageName, getTypeAsDisplayString, getTypeDependencyType, getTypeReference, hasCollapseWhiteSpace, hasExplicitComment, hasMetaTagByName, hasModifier, hasNamespace, hasRichTextContent, inPackageNamespace, isBindable, isBindableStyle, isColor, isContingent, isContingentNeeded, isDeprecated, isDynamic, isEmpty, isFinal, isGeneratedEmbedClass, isImplicit, isInProject, isInternal, isNative, isOverride, isPrivate, isProtected, isPublic, isRequiredSkinPart, isStatic, resolveNamespace, resolveType, resolveType, resolveType, resolveType, resolveType, setBindable, setContainingScope, setContingent, setDynamic, setFinal, setGeneratedEmbedClass, setImplicit, setLocation, setMetaTags, setModifier, setNameLocation, setNamespaceReference, setNative, setOverride, setPublic, setStatic, setTypeReference, toStorageName, toString, unsetOverrideclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetContainedScopegetExplicitSourceComment, hasExplicitCommentgetAbsoluteEnd, getAbsoluteStart, getAllMetaTags, getAncestorOfType, getBaseName, getBindableEventNames, getColumn, getContainingFilePath, getContainingScope, getContainingSourceFilePath, getDeprecationInfo, getEnd, getLine, getMetaTagByName, getMetaTagsByName, getModifiers, getNameColumn, getNameEnd, getNameLine, getNamespaceReference, getNameStart, getNode, getPackageName, getParent, getQualifiedName, getSourcePath, getStart, getTypeAsDisplayString, getTypeReference, hasMetaTagByName, hasModifier, hasNamespace, isBindable, isBindableStyle, isContingent, isContingentNeeded, isDeprecated, isDynamic, isFinal, isGeneratedEmbedClass, isImplicit, isInProject, isInternal, isNative, isOverride, isPrivate, isProtected, isPublic, isStatic, resolveNamespace, resolveTypepublic FunctionDefinition(String name)
public void setNode(IDefinitionNode node)
DefinitionBasesetNode in class DefinitionBasenode - The IDefinitionNode that is producing
this definition.public IFunctionDefinition.FunctionClassification getFunctionClassification()
IFunctionDefinitiongetFunctionClassification in interface IFunctionDefinitionpublic ParameterDefinition[] getParameters()
IFunctionDefinitionIParameterDefinition elementsgetParameters in interface IFunctionDefinitionpublic boolean hasRequiredParameters()
IFunctionDefinitiontrue if the function has required parameters.hasRequiredParameters in interface IFunctionDefinitionpublic void setParameters(ParameterDefinition[] value)
public String getReturnTypeAsDisplayString()
IFunctionDefinitionIReference for its return type
to a human-readable String.
If the definition does not have a return type reference, this method returns the empty string.
This method should only be used for displaying return types in problems, and not for making semantic decisions.
Note:
getReturnTypeAsDisplayString in interface IFunctionDefinitionIReference.getDisplayString()()
on the IReference representing this definition's return type.public void setReturnTypeReference(IReference returnTypeReference)
returnTypeReference - An IReference to a class or interface.public IReference getReturnTypeReference()
IFunctionDefinition
For example, for the function private function f(i:int):String,
this is a reference to the String class.
getReturnTypeReference in interface IFunctionDefinitionIReference to a class or interface.public ITypeDefinition resolveReturnType(ICompilerProject project)
IFunctionDefinitionresolveReturnType in interface IFunctionDefinitionproject - the ICompilerProject in which to resolve
referencesITypeDefinition representing this function's return
type, or nullpublic boolean isConstructor()
IFunctionDefinitionisConstructor in interface IFunctionDefinitionpublic void setAsConstructor(ClassDefinition classDef)
public boolean isCastFunction()
IFunctionDefinitionisCastFunction in interface IFunctionDefinitionpublic void setCastFunction()
public boolean inlineFunction()
IFunctionDefinitioninlineFunction in interface IFunctionDefinitionpublic final boolean isInline()
IFunctionDefinitioninline?isInline in interface IFunctionDefinitiontrue if the function is inline.protected final boolean canFunctionBeInlined()
public boolean overridesAncestor(ICompilerProject project)
IFunctionDefinitionoverridesAncestor in interface IFunctionDefinitionpublic FunctionDefinition resolveOverriddenFunction(ICompilerProject project)
IFunctionDefinitionresolveOverriddenFunction in interface IFunctionDefinitionIFunctionDefinition or nullpublic boolean isImplementation(ICompilerProject project)
IFunctionDefinitionisImplementation in interface IFunctionDefinitionpublic List<IFunctionDefinition> resolveOverridenInterfaceFunctions(ICompilerProject project)
project - The project to use to resolve referencespublic IFunctionDefinition resolveImplementedFunction(ICompilerProject project)
IFunctionDefinitionresolveImplementedFunction in interface IFunctionDefinitionIFunctionDefinition or nullpublic boolean hasCompatibleSignature(IFunctionDefinition other, ICompilerProject project)
public IFunctionNode getFunctionNode()
IFunctionDefinitionIFunctionNode from which this definition was created,
if the definition came from the AST for a source file.
This method may require the AST to be reloaded or regenerated and therefore may be slow.
getFunctionNode in interface IFunctionDefinitionpublic boolean isTopLevelDefinition()
isTopLevelDefinition in class DefinitionBasepublic boolean matches(DefinitionBase definition)
matches in class DefinitionBaseprotected void buildInnerString(StringBuilder sb)
public function f(int, String):void.buildInnerString in class DefinitionBaseCopyright © 2016 The Apache Software Foundation. All rights reserved.