public class ClassNode extends MemberedNode implements IClassNode
Modifier and Type | Field and Description |
---|---|
protected ExpressionNodeBase |
baseClassNode
The name of the base class
|
protected KeywordNode |
classKeywordNode
The class keyword
|
protected FunctionNode |
constructorNode
Generated FunctionNode to represent explicit or default constructor
|
protected FunctionNode |
defaultConstructorNode
Generated FunctionNode to represent default constructor (if there isn't
an explicit one)
|
protected KeywordNode |
extendsKeywordNode
The extends keyword (if one is present)
|
protected KeywordNode |
implementsKeywordNode
The extends keyword (if one is present)
|
protected TransparentContainerNode |
interfacesNode
Container full of interfaces implemented by this class
|
contentsNode
definition, nameNode
emptyNodeArray, parent
UNKNOWN
Constructor and Description |
---|
ClassNode(ExpressionNodeBase name)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addInterface(ExpressionNodeBase interfaceName)
Add an implemented interface to this class.
|
protected void |
analyze(EnumSet<PostProcessStep> set,
ASScope scope,
Collection<ICompilerProblem> problems) |
void |
buildExplicitMemberDefs(TypeScope classScope)
Method that will only build the explicit definitions for this AS3 class.
|
protected boolean |
buildInnerString(StringBuilder sb)
For debugging only.
|
boolean |
canCacheMetaTags()
If a classes containing file has includes, it's metadata values cannot be
cached
|
IDefinitionNode[] |
getAllMemberNodes()
Returns an array of
IDefinitionNode objects that represent all
the children of this class that are members. |
IExpressionNode |
getBaseClassExpressionNode() |
String |
getBaseClassName()
Returns the name of this class' base class, if it exists.
|
ExpressionNodeBase |
getBaseClassNode()
Get the node containing the base class, if one exists
|
IClassDefinition.ClassClassification |
getClassClassification()
Returns the classification of this ActionScript class
|
KeywordNode |
getClassKeywordNode()
Get the node containing the class keyword
|
FunctionNode |
getConstructorNode()
Get the node representing the constructor
|
FunctionNode |
getDefaultConstructorNode()
Get the node representing the default constructor (if there's no explicit
constructor)
|
ClassDefinition |
getDefinition()
Returns the class definition corresponding to this class node.
|
KeywordNode |
getExtendsKeywordNode()
Get the node containing the extends keyword, if one exists
|
IExpressionNode[] |
getImplementedInterfaceNodes() |
String[] |
getImplementedInterfaces()
Returns the names of any interfaces that this class declares it
implements.
|
KeywordNode |
getImplementsKeywordNode()
Get the node containing the implements keyword, if one exists
|
protected int |
getInitialChildCount()
Take a guess as to an efficient initial child count.
|
String[] |
getInterfaceNames()
Get the implemented interface names (as they appear in the class
definition)
|
ContainerNode |
getInterfacesNode()
Get the container of interfaces for this class
|
IMetaTagNode[] |
getMetaTagNodesByName(String name)
Retrieve all of the meta attributes (e.g.
|
IMetaTag[] |
getMetaTagsByName(String name)
Retrieve all of the meta attributes (e.g.
|
protected void |
getMetaTagsByName(String name,
RecursionGuard recursionGuard,
ArrayList<IMetaTagNode> allMatchingAttributes)
Retrieves all of the matching meta attributes associated with this class
or any of its base classes
|
ASTNodeID |
getNodeID()
Get the opcode of this node
|
String |
getQualifiedName()
Get the qualified name of this type
|
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.
|
protected void |
init(ExpressionNodeBase nameNode) |
boolean |
isImplicit()
Is this definition an implicit definition that doesn't actually appear in
the source file?
|
void |
setBaseClass(ExpressionNodeBase baseClassNode)
Set the base class of this class.
|
protected void |
setChildren(boolean fillInOffsets)
If this node has custom children (names, arguments, etc), shove them into
the list of children.
|
void |
setClassKeyword(IASToken classKeyword)
Sets the class keyword if one is present.
|
void |
setDefinition(IDefinition def) |
void |
setExtendsKeyword(IASToken extendsKeyword)
Sets the extends keyword if one is present.
|
void |
setImplementsKeyword(IASToken implementsKeyword)
Sets the implements keyword if one is present.
|
getAllMemberDefinitionNodes, getScopedNode
addDecorationChildren, addModifier, createDecorationPart, fillInMetadata, fillInModifiers, fillInNamespaceAndModifiers, getASDocComment, getDecorationPart, getMetaInfos, getMetaTags, getMetaTagsNode, getModifiers, getModifiersContainer, getName, getNameAbsoluteEnd, getNameAbsoluteStart, getNameEnd, getNameExpressionNode, getNamespace, getNamespaceNode, getNameStart, getNodeStartForTooling, hasExplicitComment, hasModifier, hasNamespace, normalize, setASDocComment, setMetaTags, setModifiersContainer, setNamespace
addChild, addChild, addChildInOrder, addChildPostNormalize, addTemporaryChild, getChild, getChildCount, optimizeChildren, removeAllChildren, removeChild, removeTemporaryChild, replaceChild, sortChildren, swapChildren
buildStringRecursive, 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, verify
getColumn, getEndColumn, getEndLine, getLine, getLineColumnString, getOffsetsString, getSourcePath, getSourcePathString, setColumn, setEnd, setEndColumn, setEndLine, setLine, setSourceLocation, setSourcePath, setStart, span, span
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getScopedNode
getContainingFilePath, getMetaInfos, getMetaTags, getName, getNameAbsoluteEnd, getNameAbsoluteStart, getNameEnd, getNameExpressionNode, getNamespace, getNameStart, getPackageName, hasModifier, hasNamespace
contains, getAncestorOfType, getChild, getChildCount, getContainingNode, getContainingScope, getFileSpecification, getParent, getSucceedingNode, isTerminal
getAbsoluteEnd, getAbsoluteStart, getColumn, getEnd, getEndColumn, getEndLine, getLine, getSourcePath, getStart
getASDocComment, hasExplicitComment
protected KeywordNode classKeywordNode
protected KeywordNode extendsKeywordNode
protected ExpressionNodeBase baseClassNode
protected KeywordNode implementsKeywordNode
protected TransparentContainerNode interfacesNode
protected FunctionNode constructorNode
protected FunctionNode defaultConstructorNode
public ClassNode(ExpressionNodeBase name)
name
- The node holding this class name.public ASTNodeID getNodeID()
IASNode
public int getSpanningStart()
IASNode
getSpanningStart
in interface IASNode
getSpanningStart
in class BaseDefinitionNode
protected void setChildren(boolean fillInOffsets)
NodeBase
setChildren
in class NodeBase
protected void analyze(EnumSet<PostProcessStep> set, ASScope scope, Collection<ICompilerProblem> problems)
analyze
in class BaseDefinitionNode
protected boolean buildInnerString(StringBuilder sb)
NodeBase
buildOuterString()
.
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 NodeBase
protected int getInitialChildCount()
TreeNode
getInitialChildCount
in class TreeNode
protected void init(ExpressionNodeBase nameNode)
init
in class BaseDefinitionNode
public ClassDefinition getDefinition()
ICommonClassNode
getDefinition
in interface ICommonClassNode
getDefinition
in interface IDefinitionNode
getDefinition
in class BaseDefinitionNode
public void setDefinition(IDefinition def)
setDefinition
in class BaseDefinitionNode
public boolean isImplicit()
IDefinitionNode
this
, super
,
default constructors, and cast functions.isImplicit
in interface IDefinitionNode
public String getQualifiedName()
IDefinitionNode
getQualifiedName
in interface IDefinitionNode
public String getShortName()
IDefinitionNode
getShortName
in interface IDefinitionNode
public IClassDefinition.ClassClassification getClassClassification()
ICommonClassNode
getClassClassification
in interface ICommonClassNode
IClassDefinition.ClassClassification
objectpublic IMetaTag[] getMetaTagsByName(String name)
ICommonClassNode
getMetaTagsByName
in interface ICommonClassNode
name
- name of meta attributes to search for (e.g. Event or
IconFile)public IMetaTagNode[] getMetaTagNodesByName(String name)
IClassNode
getMetaTagNodesByName
in interface IClassNode
name
- name of meta attributes to search for (e.g. Event or
IconFile)public IExpressionNode getBaseClassExpressionNode()
getBaseClassExpressionNode
in interface IClassNode
public String getBaseClassName()
ICommonClassNode
getBaseClassName
in interface ICommonClassNode
public IExpressionNode[] getImplementedInterfaceNodes()
getImplementedInterfaceNodes
in interface IClassNode
public String[] getImplementedInterfaces()
ICommonClassNode
getImplementedInterfaces
in interface ICommonClassNode
public IDefinitionNode[] getAllMemberNodes()
IClassNode
IDefinitionNode
objects that represent all
the children of this class that are members. These include functions,
variables and namespacesgetAllMemberNodes
in interface IClassNode
IDefinitionNode
children, or an empty arraypublic void setClassKeyword(IASToken classKeyword)
classKeyword
- token containing the keywordpublic void setExtendsKeyword(IASToken extendsKeyword)
extendsKeyword
- token containing the keywordpublic void setBaseClass(ExpressionNodeBase baseClassNode)
baseClassNode
- node containing the base class namepublic void setImplementsKeyword(IASToken implementsKeyword)
implementsKeyword
- token containing the keywordpublic void addInterface(ExpressionNodeBase interfaceName)
interfaceName
- node containing the interface namepublic void buildExplicitMemberDefs(TypeScope classScope)
classScope
- TypeScope
into which this AS3 class' definition
should be added.public FunctionNode getConstructorNode()
public FunctionNode getDefaultConstructorNode()
public String[] getInterfaceNames()
public KeywordNode getClassKeywordNode()
public KeywordNode getExtendsKeywordNode()
public ExpressionNodeBase getBaseClassNode()
public KeywordNode getImplementsKeywordNode()
public ContainerNode getInterfacesNode()
protected void getMetaTagsByName(String name, RecursionGuard recursionGuard, ArrayList<IMetaTagNode> allMatchingAttributes)
name
- name of meta attributes to retrieverecursionGuard
- guard to help avoid infinite loops in the base
class hierarchyallMatchingAttributes
- list to be filled with all matching meta
attributespublic boolean canCacheMetaTags()
Copyright © 2016 The Apache Software Foundation. All rights reserved.