public class ClassDefinition extends ClassDefinitionBase implements IClassDefinition
After a class definition is in the symbol table, it should always be accessed
through the read-only IClassDefinition interface.
ClassDefinitionBase.ClassIteratorTypeDefinitionBase.StaticTypeIterator, TypeDefinitionBase.TypeIteratorIClassDefinition.ClassClassification, IClassDefinition.IClassIterator| Modifier and Type | Field and Description |
|---|---|
static String |
Event |
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 |
|---|
ClassDefinition(String name,
INamespaceReference namespaceRef)
Constructs a new class definition with an auto generated protected
namespace.
|
ClassDefinition(String name,
INamespaceReference namespaceRef,
INamespaceDefinition.IProtectedNamespaceDefinition protectedNamespace)
Constructs a new class definition with an explicit protected namespace.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addImplicitImport(String qname)
Adds a new node to the list of nodes representing the implicit imports
created by MXML tags.
|
void |
addStateName(String stateName)
Add a state name to the class
|
void |
buildContingentDefinitions()
Build any contingent definitions that may be required for the class such
as hostComponent.
|
protected void |
buildInnerString(StringBuilder sb)
For debugging only.
|
VariableDefinition |
buildOuterDocumentMember(IReference outerClass) |
IEffectDefinition[] |
findEffectDefinitions(ICompilerProject project)
Finds the effect definitions for effect declared on this class or any of
its superclasses.
|
IEventDefinition[] |
findEventDefinitions(ICompilerProject project)
Finds the event definitions for events declared on this class or any of
its superclasses.
|
IMetaTag[] |
findSkinParts(ICompilerProject project,
Collection<ICompilerProblem> problems)
Finds the skin parts declared on this class or any of its superclasses.
|
String[] |
findSkinStates(ICompilerProject project,
Collection<ICompilerProblem> problems)
Finds the skin state names declared on this class or any of its
superclasses.
|
Set<String> |
findStateNames(ICompilerProject project)
Finds the state names declared on this class or any of its superclasses.
|
IStyleDefinition[] |
findStyleDefinitions(ICompilerProject project)
Finds the style definitions for styles declared on this class or any of
its superclasses.
|
static IClassDefinition |
getAnyTypeClassDefinition() |
String |
getBaseClassAsDisplayString()
Converts this class's
IReference for its base class
to a human-readable String. |
IReference |
getBaseClassReference()
Gets a reference to the base class for this class.
|
IClassDefinition.ClassClassification |
getClassClassification()
Returns the classification of this ActionScript class
|
IFunctionDefinition |
getConstructor()
Gets the constructor function for this class.
|
List<IDefinition> |
getContingentDefinitions() |
String |
getDefaultPropertyName(ICompilerProject project)
Gets the name of the default property for this class.
|
IEffectDefinition |
getEffectDefinition(IWorkspace w,
String name)
Gets an effect definition for an effect declared on this class with a
particular name such as
"moveEffect". |
IEffectDefinition[] |
getEffectDefinitions(IWorkspace w)
Gets the effect definitions for effects declared on this class.
|
EmbedData |
getEmbeddedAsset(CompilerProject project,
Collection<ICompilerProblem> problems)
Get any embedded data decorating the class definition
|
IEventDefinition |
getEventDefinition(IWorkspace w,
String name)
Gets an event definition for an event declared on this class with a
particular name such as
"click". |
IEventDefinition[] |
getEventDefinitions(IWorkspace w)
Gets the event definitions for events declared on this class.
|
ASFileScope |
getFileScope() |
IReference[] |
getImplementedInterfaceReferences()
Returns
IReference objects that will resolve to any interface this
class directly implements. |
String[] |
getImplementedInterfacesAsDisplayStrings()
Returns the names of any interfaces that this class directly references.
|
String[] |
getImplicitImports()
Gets the implicit imports created by MXML tags, for use by CodeModel.
|
Name |
getMName(ICompilerProject project)
Generate an AET Name object for this definition, and log any Problems
encountered while constructing the Name, to the list of problems passed
in.
|
static IClassDefinition |
getNullClassDefinition() |
boolean |
getOwnNeedsProtected() |
INamespaceDefinition.ILanguageNamespaceDefinition |
getPrivateNamespaceReference()
Gets the
INamespaceReference that resolves to the private
namespace for this IClassDefinition. |
INamespaceDefinition.ILanguageNamespaceDefinition |
getProtectedNamespaceReference()
Gets the
INamespaceReference that resolves to the protected
namespace for this IClassDefinition. |
String |
getRemoteClassAlias()
Get's the remote class alias for this class.
|
IMetaTag[] |
getSkinParts(Collection<ICompilerProblem> problems)
Gets the skin parts declared on this class.
|
String[] |
getSkinStates(Collection<ICompilerProblem> problems)
Gets the skin state names declared on this class.
|
Set<String> |
getStateNames()
Gets the state names declared on this class.
|
INamespaceDefinition.ILanguageNamespaceDefinition |
getStaticProtectedNamespaceReference()
Gets the
INamespaceReference that resolves to the static
protected namespace for this IClassDefinition. |
IStyleDefinition |
getStyleDefinition(IWorkspace workspace,
String name)
Gets a style definition for a style declared on this class with a
particular name such as
"fontSize". |
IStyleDefinition[] |
getStyleDefinitions(IWorkspace w)
Gets the style definitions for styles declared on this class.
|
static IClassDefinition |
getUndefinedClassDefinition() |
static IClassDefinition |
getVoidClassDefinition() |
boolean |
hasOwnFactoryClass(IWorkspace w) |
boolean |
isInProject(ICompilerProject project)
Debugging method that can be used to assert that a definition is a specified project.
|
IClassDefinition |
resolveBaseClass(ICompilerProject project)
Finds the definition of the base class for this class.
|
Collection<IDefinition> |
resolveExtraClasses(ICompilerProject project) |
IClassDefinition |
resolveHostComponent(ICompilerProject project)
Finds the
IClassDefinition for the host component class, declared with [HostComponent(...)] |
ClassDefinition |
resolveInheritedFactoryClass(ICompilerProject project) |
void |
setBaseClassReference(IReference baseClassReference)
Sets a reference to the base class for this class.
|
protected void |
setConstructor(IFunctionDefinition constructor) |
void |
setContainedScope(IASScope value) |
void |
setExcludedClass()
Mark this class as an excluded class by adding [ExcludeClass] meta data.
|
void |
setImplementedInterfaceReferences(IReference[] interfaceReferences) |
void |
setupThisAndSuper()
Adds implicit variable definitions for "this" and "super" to this class
definition's contained scope.
|
void |
verifyHostComponent(CompilerProject project,
Collection<ICompilerProblem> problems)
If there is host component meta data on the class, run semantic checks on
it.
|
classIterable, classIterator, computeNeedsEventDispatcher, findMetaTagsByName, getAlternativeClasses, getIconFile, interfaceIterator, isInstanceOf, needsEventDispatcher, needsStaticEventDispatcher, resolveAllInterfaces, resolveAncestry, resolveImplementedInterface, resolveImplementedInterfaces, resolveImplementedInterfaces, resolveImplementedInterfaces, resolveInterfacesImplfilterNullInterfaces, getNameStart, getNode, getPackageName, isInstanceOf, resolveType, staticTypeIterable, typeIteratablegetContainedScope, verifyaddMetaTag, buildString, getAbsoluteEnd, getAbsoluteStart, getAllMetaTags, getAncestorOfType, getArrayElementType, getBaseName, getBindableEventNames, getColumn, getContainingASScope, getContainingFilePath, getContainingScope, getContainingSourceFilePath, getDefinition, getDeprecationInfo, getEnd, getExplicitSourceComment, getFileSpecification, getInstanceType, getLine, getLocationString, getMaxSize, getMetaTagByName, getMetaTagsByName, getModifiers, getNameColumn, getNameEnd, getNameLine, getNamespaceReference, getNamespaceReferenceAsString, 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, isInternal, isNative, isOverride, isPrivate, isProtected, isPublic, isRequiredSkinPart, isStatic, isTopLevelDefinition, matches, resolveNamespace, resolveType, resolveType, resolveType, resolveType, setBindable, setContainingScope, setContingent, setDynamic, setFinal, setGeneratedEmbedClass, setImplicit, setLocation, setMetaTags, setModifier, setNameLocation, setNamespaceReference, setNative, setNode, setOverride, setPublic, setStatic, setTypeReference, toStorageName, toString, unsetOverrideclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclassIterator, findMetaTagsByName, getAlternativeClasses, getIconFile, interfaceIterator, needsEventDispatcher, needsStaticEventDispatcher, resolveAncestry, resolveImplementedInterfacesgetNode, isInstanceOf, isInstanceOf, resolveAllInterfaces, typeIteratablegetContainedScopegetExplicitSourceComment, hasExplicitCommentgetAbsoluteEnd, 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, isInternal, isNative, isOverride, isPrivate, isProtected, isPublic, isStatic, resolveNamespace, resolveTypepublic static String Event
public ClassDefinition(String name, INamespaceReference namespaceRef)
name - Base name of the class definition, eg: DisplayObject, not
flash.display.DisplayObject.namespaceRef - INamespaceReference qualifier. Usually this
will be a INamespaceDefinition.IPublicNamespaceDefinition whose
URI is a package name like flash.display.public ClassDefinition(String name, INamespaceReference namespaceRef, INamespaceDefinition.IProtectedNamespaceDefinition protectedNamespace)
name - Base name of the class definition, eg: DisplayObject, not
flash.display.DisplayObject.namespaceRef - INamespaceReference qualifier. Usually this
will be a INamespaceDefinition.IPublicNamespaceDefinition whose
URI is a package name like flash.display.protectedNamespace - Protected namespace that will be used to
qualifier protected instance members of the ABC class.public static IClassDefinition getAnyTypeClassDefinition()
public static IClassDefinition getNullClassDefinition()
public static IClassDefinition getUndefinedClassDefinition()
public static IClassDefinition getVoidClassDefinition()
public IClassDefinition.ClassClassification getClassClassification()
IClassDefinitiongetClassClassification in interface IClassDefinitionIClassDefinition.ClassClassification objectpublic IFunctionDefinition getConstructor()
IClassDefinitiongetConstructor in interface IClassDefinitionIFunctionDefinition representing the constructor.protected void setConstructor(IFunctionDefinition constructor)
public String getBaseClassAsDisplayString()
IClassDefinitionIReference for its base class
to a human-readable String.
If this class does not have a base class reference, this method returns the empty string.
This method should only be used for displaying the base class, and not for making semantic decisions.
getBaseClassAsDisplayString in interface IClassDefinitionIReference.getDisplayString()()
on the IReference representing this class's base class.public IReference getBaseClassReference()
IClassDefinitiongetBaseClassReference in interface IClassDefinitionIReference referring to the base class.public void setBaseClassReference(IReference baseClassReference)
baseClassReference - An IReference referring to the base
class.public IClassDefinition resolveBaseClass(ICompilerProject project)
IClassDefinition
Note that Object does not have a base class, so this method
returns null if called on the class definition for
Object.
It will also return null in the following error cases:
Note: SemanticUtils.resolveBaseClass(org.apache.flex.compiler.tree.as.ICommonClassNode, org.apache.flex.compiler.internal.definitions.ClassDefinition, org.apache.flex.compiler.projects.ICompilerProject, java.util.Collection<org.apache.flex.compiler.problems.ICompilerProblem>) is similar, but actually
reports the various error cases as problems, and returns
Object instead of null in the error cases so
that the code generator gives the class a valid superclass.
resolveBaseClass in interface IClassDefinitionIClassDefinition or null.public String[] getImplementedInterfacesAsDisplayStrings()
IClassDefinitiongetImplementedInterfacesAsDisplayStrings in interface IClassDefinitionpublic void setImplementedInterfaceReferences(IReference[] interfaceReferences)
public IReference[] getImplementedInterfaceReferences()
IClassDefinitionIReference objects that will resolve to any interface this
class directly implements. This does not walk of the inheritance chain.getImplementedInterfaceReferences in interface IClassDefinitiongetImplementedInterfaceReferences in class ClassDefinitionBaseIReference objects, or an empty array.public IEventDefinition getEventDefinition(IWorkspace w, String name)
IClassDefinition"click".
If there is no such event, this method returns null.
This method does not find events defined on superclasses.
getEventDefinition in interface IClassDefinitionname - The name of the event.IEventDefinition object.public IEventDefinition[] getEventDefinitions(IWorkspace w)
IClassDefinitionIf there are no events declared, this method returns an empty array.
This method does not find events defined on superclasses.
getEventDefinitions in interface IClassDefinitionIEventDefinition objects.public IEventDefinition[] findEventDefinitions(ICompilerProject project)
IClassDefinitionIf there are no events declared, this method returns an empty array.
The event definitions returned are guaranteed to have unique event names. If an event is declared with the same name on a superclass and a subclass, the event on the subclass overrides the one on the superclass.
findEventDefinitions in interface IClassDefinitionproject - An ICompilerProject object used to determine the
superclass chain.IEventDefinition objects.public IStyleDefinition getStyleDefinition(IWorkspace workspace, String name)
IClassDefinition"fontSize".
If there is no such style, this method returns null.
This method does not find styles defined on superclasses.
getStyleDefinition in interface IClassDefinitionname - The name of the style.IStyleDefinition object.public IStyleDefinition[] getStyleDefinitions(IWorkspace w)
IClassDefinitionIf there are no styles declared, this method returns an empty array.
This method does not find styles defined on superclasses.
getStyleDefinitions in interface IClassDefinitionIStyleDefinition objects.public IStyleDefinition[] findStyleDefinitions(ICompilerProject project)
IClassDefinitionIf there are no styles declared, this method returns an empty array.
The style definitions returned are guaranteed to have unique style names. If a style is declared with the same name on a superclass and a subclass, the style on the subclass overrides the one on the superclass.
findStyleDefinitions in interface IClassDefinitionproject - An ICompilerProject object used to determine the
superclass chain.IStyleDefinition objects.public IEffectDefinition getEffectDefinition(IWorkspace w, String name)
IClassDefinition"moveEffect".
If there is no such effect, this method returns null.
This method does not find effects defined on superclasses.
getEffectDefinition in interface IClassDefinitionname - The name of the effect.IEffectDefinition object.public IEffectDefinition[] getEffectDefinitions(IWorkspace w)
IClassDefinitionIf there are no effects declared, this method returns an empty array.
This method does not find effects defined on superclasses.
getEffectDefinitions in interface IClassDefinitionIEffectDefinition objects.public IEffectDefinition[] findEffectDefinitions(ICompilerProject project)
IClassDefinitionIf there are no effects declared, this method returns an empty array.
The effect definitions returned are guaranteed to have unique effect names. If an effect is declared with the same name on a superclass and a subclass, the effect on the subclass overrides the one on the superclass.
findEffectDefinitions in interface IClassDefinitionproject - An ICompilerProject object used to determine the
superclass chain.IEffectDefinition objects.public String[] getSkinStates(Collection<ICompilerProblem> problems)
IClassDefinitionIf there are no skin states declared, this method returns an empty array.
This method does not find skin states defined on superclasses.
getSkinStates in interface IClassDefinitionString objects.public String[] findSkinStates(ICompilerProject project, Collection<ICompilerProblem> problems)
IClassDefinitionIf there are no skin states declared, this method returns an empty array.
The state names returned are guaranteed to have unique names with no duplicates.
findSkinStates in interface IClassDefinitionproject - An ICompilerProject object used to determine the
superclass chain.String objects.public EmbedData getEmbeddedAsset(CompilerProject project, Collection<ICompilerProblem> problems)
project - Project to resolve againstproblems - Any problems resolving the embedded datapublic IMetaTag[] getSkinParts(Collection<ICompilerProblem> problems)
IClassDefinitionIf there are no skin parts declared, this method returns an empty array.
This method does not find skin parts defined on superclasses.
getSkinParts in interface IClassDefinitionIMetaTag objects.public IMetaTag[] findSkinParts(ICompilerProject project, Collection<ICompilerProblem> problems)
IClassDefinitionIf there are no skin parts declared, this method returns an empty array.
The skin parts returned are guaranteed to have unique names. If a skin part is declared with the same name on a superclass and a subclass, the skin part on the subclass overrides the one on the superclass.
findSkinParts in interface IClassDefinitionproject - An ICompilerProject object used to determine the
superclass chain.IVariableDefinition objects.public void addStateName(String stateName)
stateName - The name to addpublic Set<String> getStateNames()
IClassDefinitionIf there are no states declared, this method returns an empty set.
This method does not find states defined on superclasses.
getStateNames in interface IClassDefinitionString objects.public Set<String> findStateNames(ICompilerProject project)
IClassDefinitionIf there are no states declared, this method returns an empty set.
findStateNames in interface IClassDefinitionproject - An ICompilerProject object used to determine the
superclass chain.String objects.public List<IDefinition> getContingentDefinitions()
public void buildContingentDefinitions()
public void verifyHostComponent(CompilerProject project, Collection<ICompilerProblem> problems)
project - The compiler project.problems - The collection of compiler problems to which this method should add problems.public VariableDefinition buildOuterDocumentMember(IReference outerClass)
public boolean hasOwnFactoryClass(IWorkspace w)
public String getRemoteClassAlias()
public ClassDefinition resolveInheritedFactoryClass(ICompilerProject project)
public Collection<IDefinition> resolveExtraClasses(ICompilerProject project)
public String getDefaultPropertyName(ICompilerProject project)
IClassDefinitiongetDefaultPropertyName in interface IClassDefinitionpublic void setContainedScope(IASScope value)
setContainedScope in class ScopedDefinitionBasepublic INamespaceDefinition.ILanguageNamespaceDefinition getPrivateNamespaceReference()
INamespaceReference that resolves to the private
namespace for this IClassDefinition.INamespaceReference that resolves to the private
namespace for this IClassDefinition.public INamespaceDefinition.ILanguageNamespaceDefinition getProtectedNamespaceReference()
INamespaceReference that resolves to the protected
namespace for this IClassDefinition.getProtectedNamespaceReference in interface ITypeDefinitionINamespaceReference that resolves to the protected
namespace for this IClassDefinition.public INamespaceDefinition.ILanguageNamespaceDefinition getStaticProtectedNamespaceReference()
INamespaceReference that resolves to the static
protected namespace for this IClassDefinition.getStaticProtectedNamespaceReference in interface ITypeDefinitionINamespaceReference that resolves to the static
protected namespace for this IClassDefinition.public Name getMName(ICompilerProject project)
DefinitionBasegetMName in class DefinitionBaseproject - the Project to use when resolving the Definitions
Namespacepublic ASFileScope getFileScope()
getFileScope in class DefinitionBasepublic void addImplicitImport(String qname)
public String[] getImplicitImports()
MXMLImplicitImportNode objects.public void setupThisAndSuper()
public void setExcludedClass()
protected void buildInnerString(StringBuilder sb)
public class B extends A implements I1, I2.buildInnerString in class DefinitionBasepublic boolean getOwnNeedsProtected()
public IClassDefinition resolveHostComponent(ICompilerProject project)
IClassDefinitionIClassDefinition for the host component class, declared with [HostComponent(...)] metadata on
this class or one of its superclasses.
If there is no [HostComponent(...)] metadata on this class or any of its superclasses, this method returns null.
resolveHostComponent in interface IClassDefinitionproject - An ICompilerProject object used to determine the
superclass chain and to resolve the class referenced in the [HostComponent(...)] metadata.IClassDefinition for the host component class.public boolean isInProject(ICompilerProject project)
IDefinitionisInProject in interface IDefinitionisInProject in class DefinitionBaseCopyright © 2016 The Apache Software Foundation. All rights reserved.