public class VariableDefinition extends DefinitionBase implements IVariableDefinition
After a variable definition is in the symbol table, it should always be
accessed through the read-only IVariableDefinition
interface.
IVariableDefinition.VariableClassification
Modifier and Type | Field and Description |
---|---|
protected Object |
initValue
The initial value of this VariableDefinition, if it is known this is used
for variables that come from an ABC with a value specified in the traits
entry.
|
FLAG_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 |
---|
VariableDefinition(String name)
Constructor.
|
VariableDefinition(String name,
Object initialValue)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
buildInnerString(StringBuilder sb)
For debugging only.
|
boolean |
declaredInControlFlow()
Was this variable declared inside a control flow construct?
|
protected IExpressionNode |
getInitExpression() |
IVariableNode |
getNode()
Returns the
IDefinitionNode from which this definition was
created, if the definition came from the AST for a source file. |
protected DependencyType |
getTypeDependencyType()
Gets the
DependencyType that should be used when resolving the
type of this variable definition. |
IVariableDefinition.VariableClassification |
getVariableClassification()
Get the classification for this variable (local, parameter, class member,
etc)
|
IVariableNode |
getVariableNode()
Returns the
IVariableNode from which this definition was created,
if the definition came from the AST for a source file. |
boolean |
isRequiredSkinPart()
Check whether the variable is a required skin part.
|
boolean |
isSkinPart()
Check whether the variable is a skin part.
|
boolean |
matches(DefinitionBase node) |
Object |
resolveInitialValue(ICompilerProject project)
Try to calculate the initial value for this VariableDefinition.
|
void |
setDeclaredInControlFlow(boolean b)
Tell this definition whether it was declared in a control flow block
or not.
|
void |
setInitializer(IExpressionNode initExpr) |
addMetaTag, 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, getPackageName, getParent, getPercentProxy, getQualifiedName, getSize, getSkinPart, getSourcePath, getStart, getStorageName, getTypeAsDisplayString, 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, isTopLevelDefinition, resolveNamespace, resolveType, resolveType, resolveType, resolveType, resolveType, setBindable, setContainingScope, setContingent, setDynamic, setFinal, setGeneratedEmbedClass, setImplicit, setLocation, setMetaTags, setModifier, setNameLocation, setNamespaceReference, setNative, setNode, setOverride, setPublic, setStatic, setTypeReference, toStorageName, toString, unsetOverride, verify
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getArrayElementType, getInstanceType, getPercentProxy, hasCollapseWhiteSpace, hasRichTextContent, isColor
getExplicitSourceComment, hasExplicitComment
getAbsoluteEnd, getAbsoluteStart, getAllMetaTags, getAncestorOfType, getBaseName, getBindableEventNames, getColumn, getContainingFilePath, getContainingScope, getContainingSourceFilePath, getDeprecationInfo, getEnd, getLine, getMetaTagByName, getMetaTagsByName, getModifiers, getNameColumn, getNameEnd, getNameLine, getNamespaceReference, getNameStart, 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, resolveType
protected Object initValue
public VariableDefinition(String name)
name
- The name of the variable.public IVariableDefinition.VariableClassification getVariableClassification()
IVariableDefinition
getVariableClassification
in interface IVariableDefinition
protected DependencyType getTypeDependencyType()
DependencyType
that should be used when resolving the
type of this variable definition.
This method is intended to be overridden by sub-classes.
getTypeDependencyType
in class DefinitionBase
DependencyType
that should be used when resolving the
type of this variable definitionpublic IVariableNode getNode()
IDefinition
IDefinitionNode
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.
More specific definition interfaces such as IClassDefinition
redeclare this method to return a more specific node interface such as
IClassNode
.
getNode
in interface IDefinition
getNode
in class DefinitionBase
public IVariableNode getVariableNode()
IVariableDefinition
IVariableNode
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.
getVariableNode
in interface IVariableDefinition
public boolean matches(DefinitionBase node)
matches
in class DefinitionBase
protected void buildInnerString(StringBuilder sb)
public var i:int
.buildInnerString
in class DefinitionBase
public void setInitializer(IExpressionNode initExpr)
public Object resolveInitialValue(ICompilerProject project)
resolveInitialValue
in interface IVariableDefinition
project
- the project to use to resolve the intializerprotected IExpressionNode getInitExpression()
public boolean isSkinPart()
IVariableDefinition
isSkinPart
in interface IVariableDefinition
public boolean isRequiredSkinPart()
IVariableDefinition
isRequiredSkinPart
in interface IVariableDefinition
public void setDeclaredInControlFlow(boolean b)
b
- true if this definition was declared in control flow, otherwise false.public boolean declaredInControlFlow()
This is used in constant-evaluating the value of the variable.
Copyright © 2016 The Apache Software Foundation. All rights reserved.