public final class AppliedVectorDefinition extends ClassDefinitionBase implements IAppliedVectorDefinition
ClassDefinitionBase.ClassIterator
TypeDefinitionBase.StaticTypeIterator, TypeDefinitionBase.TypeIterator
IClassDefinition.ClassClassification, IClassDefinition.IClassIterator
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
ANY_TYPE, NULL, UNDEFINED, VOID
Constructor and Description |
---|
AppliedVectorDefinition(ICompilerProject project,
IClassDefinition baseClass,
ITypeDefinition elementType)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
adjustVectorMethods(ICompilerProject project)
Copy down definitions from Vector$object into the instantiated class as
we go, modify to the parameter and return types to match what is actually
expected (Vector$object becomes Vector.
|
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.
|
String |
getBaseClassAsDisplayString()
Converts this class's
IReference for its base class
to a human-readable String. |
String |
getBaseClassName() |
IReference |
getBaseClassReference()
Gets a reference to the base class for this class.
|
String |
getBaseName()
Gets the base (i.e., unqualified) name of this definition.
|
IClassDefinition.ClassClassification |
getClassClassification()
Returns the classification of this ActionScript class
|
IFunctionDefinition |
getConstructor()
Gets the constructor function for this class.
|
String |
getDefaultPropertyName() |
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.
|
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.
|
IExpressionNode[] |
getImplementedInterfaceNodes() |
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.
|
IMetaTag[] |
getMetaTagsByName(String name)
Gets all the
IMetaTagNode objects that match the given name |
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.
|
String |
getPackageName()
Gets the fully-qualified package name for this definition.
|
ICompilerProject |
getProject()
Gets the
ICompilerProject that this
AppliedVectorDefinition was created for. |
static ICompilerProject |
getProjectIfVectorInsantiation(IDefinition def)
Determines if the specified definition is a vector instantiation or a
contained by a vector instantiation.
|
INamespaceDefinition |
getProtectedNamespaceReference()
Gets the
INamespaceDefinition that represents the protected
namespace for this type. |
String |
getQualifiedName()
Gets the fully-qualified name of this definition.
|
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 |
getStaticProtectedNamespaceReference()
Gets the
INamespaceDefinition that represents the static
protected namespace for this type. |
IStyleDefinition |
getStyleDefinition(IWorkspace w,
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.
|
boolean |
isImplicit()
Is this definition an implicit definition that doesn't actually appear in
the source file?
|
boolean |
isInProject(ICompilerProject project)
Debugging method that can be used to assert that a definition is a specified project.
|
static boolean |
isVectorScope(ASScope scope) |
static IClassDefinition |
lookupVectorImplClass(ICompilerProject project,
String baseName)
Returns the class definition for Vector$object, Vector$int, Vector$uint, or Vector$double.
|
IClassDefinition[] |
resolveAncestry(ICompilerProject project)
Get the ancestral stack for this class, from this class all the way to
Object.
|
IClassDefinition |
resolveBaseClass(ICompilerProject project)
Finds the definition of the base class for this class.
|
ITypeDefinition |
resolveElementType(ICompilerProject project)
Resolves the class or interface definition that represents
the type of the vector's elements.
|
IClassDefinition |
resolveHostComponent(ICompilerProject project)
Finds the
IClassDefinition for the host component class, declared with [HostComponent(...)] |
protected TypeDefinitionBase |
resolveType(String typeName,
ICompilerProject project,
DependencyType dt)
This helper method resolves type references in definitions (i.e., Strings
such as "int", "Sprite", or "flash.events.IEventDispatcher" that are
stored as references to a class or interface) to the definition of the
specified type.
|
ExpressionNodeBase |
toExpression()
Returns the expression that represents the value of this vector
|
protected String |
toStorageName(String name) |
TypedExpressionNode |
toTypedExpression()
Returns a typed expression that represents the signature of this Vector
|
void |
updateBaseClass(String changedVectorImplClass)
Updates the base class of this
AppliedVectorDefinition if the
vector base name of the base class matches the base name of the vector
implementation class that has changed. |
static boolean |
vectorInstanceOfCheck(ITypeDefinition base,
ITypeDefinition derived)
Helper method that implements special instanceOf checks for Vector types.
|
classIterable, classIterator, computeNeedsEventDispatcher, findMetaTagsByName, getAlternativeClasses, getIconFile, interfaceIterator, isInstanceOf, needsEventDispatcher, needsStaticEventDispatcher, resolveAllInterfaces, resolveImplementedInterface, resolveImplementedInterfaces, resolveImplementedInterfaces, resolveImplementedInterfaces, resolveInterfacesImpl
filterNullInterfaces, getNameStart, getNode, isInstanceOf, resolveType, staticTypeIterable, typeIteratable
getContainedScope, setContainedScope, verify
addMetaTag, buildInnerString, buildString, getAbsoluteEnd, getAbsoluteStart, getAllMetaTags, getAncestorOfType, getArrayElementType, getBindableEventNames, getColumn, getContainingASScope, getContainingFilePath, getContainingScope, getContainingSourceFilePath, getDefinition, getDeprecationInfo, getEnd, getExplicitSourceComment, getFileScope, getFileSpecification, getInstanceType, getLine, getLocationString, getMaxSize, getMetaTagByName, getModifiers, getNameColumn, getNameEnd, getNameLine, getNamespaceReference, getNamespaceReferenceAsString, getParent, getPercentProxy, 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, isInternal, isNative, isOverride, isPrivate, isProtected, isPublic, isRequiredSkinPart, isStatic, isTopLevelDefinition, matches, resolveNamespace, resolveType, resolveType, resolveType, setBindable, setContainingScope, setContingent, setDynamic, setFinal, setGeneratedEmbedClass, setImplicit, setLocation, setMetaTags, setModifier, setNameLocation, setNamespaceReference, setNative, setNode, setOverride, setPublic, setStatic, setTypeReference, toString, unsetOverride
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
classIterator, findMetaTagsByName, getAlternativeClasses, getIconFile, interfaceIterator, needsEventDispatcher, needsStaticEventDispatcher, resolveImplementedInterfaces
getNode, isInstanceOf, isInstanceOf, resolveAllInterfaces, typeIteratable
getContainedScope
getExplicitSourceComment, hasExplicitComment
getAbsoluteEnd, getAbsoluteStart, getAllMetaTags, getAncestorOfType, getBindableEventNames, getColumn, getContainingFilePath, getContainingScope, getContainingSourceFilePath, getDeprecationInfo, getEnd, getLine, getMetaTagByName, getModifiers, getNameColumn, getNameEnd, getNameLine, getNamespaceReference, getNameStart, getParent, getSourcePath, getStart, getTypeAsDisplayString, getTypeReference, hasMetaTagByName, hasModifier, hasNamespace, isBindable, isBindableStyle, isContingent, isContingentNeeded, isDeprecated, isDynamic, isFinal, isGeneratedEmbedClass, isInternal, isNative, isOverride, isPrivate, isProtected, isPublic, isStatic, resolveNamespace, resolveType
public AppliedVectorDefinition(ICompilerProject project, IClassDefinition baseClass, ITypeDefinition elementType)
Don't call this constructor from anywhere other than the ASProjectScope.
project
- The compiler projectbaseClass
- The base class for the vector type, such as Vector$int
.elementType
- The definition for the element type.protected String toStorageName(String name)
toStorageName
in class DefinitionBase
public IReference getBaseClassReference()
IClassDefinition
getBaseClassReference
in interface IClassDefinition
IReference
referring to the base class.protected TypeDefinitionBase resolveType(String typeName, ICompilerProject project, DependencyType dt)
DefinitionBase
It is called by
resolveType()
in DefinitionBase to resolve a type
annotation such as the "int" on a declaration like
public var foo:int
;resolveReturnType()
in FunctionDefinition to resolve the
return type of a function declaration;resolveBaseClass()
in ClassDefinition to resolve
extends
clause of a class declaration;resolveImplementedInterfaces()
in ClassDefinition to
resolve the implements
clause of a class declaration;resolveTypeParameters()
in ParameterizedClassDefinition
to resolve the type of a Vector;resolveExtendedInterfaces()
in InterfaceDefinition to
resolve the extends
clause of an interface declaration.resolveType
in class DefinitionBase
typeName
- The name of the type to resolve.project
- The compiler project.dt
- The type of dependency to be created.public final String getQualifiedName()
IDefinition
For example, the fully-qualified name of the class definition
for the class flash.display.Sprite
is
"flash.display.Sprite"
.
getQualifiedName
in interface IDefinition
getQualifiedName
in class DefinitionBase
public final String getBaseName()
IDefinition
For example, the base name of the class definition
for the class flash.display.Sprite
is "Sprite"
.
getBaseName
in interface IDefinition
getBaseName
in class DefinitionBase
public final String getPackageName()
IDefinition
For example, the backage name of the class definition
for the class flash.display.Sprite
is "flash.display"
getPackageName
in interface IDefinition
getPackageName
in class TypeDefinitionBase
public boolean isImplicit()
IDefinition
this
, super
,
default constructors, and cast functions.isImplicit
in interface IDefinition
isImplicit
in class DefinitionBase
public IClassDefinition[] resolveAncestry(ICompilerProject project)
IClassDefinition
resolveAncestry
in interface IClassDefinition
resolveAncestry
in class ClassDefinitionBase
public String getBaseClassName()
public IClassDefinition.ClassClassification getClassClassification()
IClassDefinition
getClassClassification
in interface IClassDefinition
IClassDefinition.ClassClassification
objectpublic String[] getImplementedInterfacesAsDisplayStrings()
IClassDefinition
getImplementedInterfacesAsDisplayStrings
in interface IClassDefinition
public IReference[] getImplementedInterfaceReferences()
IClassDefinition
IReference
objects that will resolve to any interface this
class directly implements. This does not walk of the inheritance chain.getImplementedInterfaceReferences
in interface IClassDefinition
getImplementedInterfaceReferences
in class ClassDefinitionBase
IReference
objects, or an empty array.public IExpressionNode[] getImplementedInterfaceNodes()
public IMetaTag[] getMetaTagsByName(String name)
IDefinition
IMetaTagNode
objects that match the given namegetMetaTagsByName
in interface IDefinition
getMetaTagsByName
in class DefinitionBase
name
- the name to match, such as Event, Style, IconFile, etcIMetaTagNode
objects, or empty array (never
null)public ITypeDefinition resolveElementType(ICompilerProject project)
IAppliedVectorDefinition
resolveElementType
in interface IAppliedVectorDefinition
project
- The ICompilerProject
to use for resolving references.ITypeDefinition
for the class or interface definition
representing the type of the vector's elements.public ExpressionNodeBase toExpression()
public TypedExpressionNode toTypedExpression()
TypedExpressionNode
public String getBaseClassAsDisplayString()
IClassDefinition
IReference
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 IClassDefinition
IReference.getDisplayString()
()
on the IReference
representing this class's 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 IClassDefinition
IClassDefinition
or null
.public String getDefaultPropertyName()
public INamespaceDefinition getProtectedNamespaceReference()
ITypeDefinition
INamespaceDefinition
that represents the protected
namespace for this type.getProtectedNamespaceReference
in interface ITypeDefinition
INamespaceDefinition
that represents the protected
namespace for this type.public INamespaceDefinition getStaticProtectedNamespaceReference()
ITypeDefinition
INamespaceDefinition
that represents the static
protected namespace for this type.getStaticProtectedNamespaceReference
in interface ITypeDefinition
INamespaceDefinition
that represents the static
protected namespace for this type.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 IClassDefinition
name
- The name of the event.IEventDefinition
object.public IEventDefinition[] getEventDefinitions(IWorkspace w)
IClassDefinition
If there are no events declared, this method returns an empty array.
This method does not find events defined on superclasses.
getEventDefinitions
in interface IClassDefinition
IEventDefinition
objects.public IEventDefinition[] findEventDefinitions(ICompilerProject project)
IClassDefinition
If 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 IClassDefinition
project
- An ICompilerProject
object used to determine the
superclass chain.IEventDefinition
objects.public IStyleDefinition getStyleDefinition(IWorkspace w, 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 IClassDefinition
name
- The name of the style.IStyleDefinition
object.public IStyleDefinition[] getStyleDefinitions(IWorkspace w)
IClassDefinition
If there are no styles declared, this method returns an empty array.
This method does not find styles defined on superclasses.
getStyleDefinitions
in interface IClassDefinition
IStyleDefinition
objects.public IStyleDefinition[] findStyleDefinitions(ICompilerProject project)
IClassDefinition
If 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 IClassDefinition
project
- 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 IClassDefinition
name
- The name of the effect.IEffectDefinition
object.public IEffectDefinition[] getEffectDefinitions(IWorkspace w)
IClassDefinition
If there are no effects declared, this method returns an empty array.
This method does not find effects defined on superclasses.
getEffectDefinitions
in interface IClassDefinition
IEffectDefinition
objects.public IEffectDefinition[] findEffectDefinitions(ICompilerProject project)
IClassDefinition
If 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 IClassDefinition
project
- An ICompilerProject
object used to determine the
superclass chain.IEffectDefinition
objects.public String[] getSkinStates(Collection<ICompilerProblem> problems)
IClassDefinition
If 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 IClassDefinition
String
objects.public String[] findSkinStates(ICompilerProject project, Collection<ICompilerProblem> problems)
IClassDefinition
If 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 IClassDefinition
project
- An ICompilerProject
object used to determine the
superclass chain.String
objects.public IMetaTag[] getSkinParts(Collection<ICompilerProblem> problems)
IClassDefinition
If 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 IClassDefinition
IMetaTag
objects.public IMetaTag[] findSkinParts(ICompilerProject project, Collection<ICompilerProblem> problems)
IClassDefinition
If 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 IClassDefinition
project
- An ICompilerProject
object used to determine the
superclass chain.IVariableDefinition
objects.public Set<String> getStateNames()
IClassDefinition
If there are no states declared, this method returns an empty set.
This method does not find states defined on superclasses.
getStateNames
in interface IClassDefinition
String
objects.public Set<String> findStateNames(ICompilerProject project)
IClassDefinition
If there are no states declared, this method returns an empty set.
findStateNames
in interface IClassDefinition
project
- An ICompilerProject
object used to determine the
superclass chain.String
objects.public Name getMName(ICompilerProject project)
DefinitionBase
getMName
in class DefinitionBase
project
- the Project to use when resolving the Definitions
Namespacepublic void adjustVectorMethods(ICompilerProject project)
project
- Project we are inpublic ICompilerProject getProject()
ICompilerProject
that this
AppliedVectorDefinition
was created for.ICompilerProject
that this
AppliedVectorDefinition
was created forpublic String getDefaultPropertyName(ICompilerProject project)
IClassDefinition
getDefaultPropertyName
in interface IClassDefinition
public static ICompilerProject getProjectIfVectorInsantiation(IDefinition def)
def
- IDefinition
to check.public static boolean isVectorScope(ASScope scope)
public IFunctionDefinition getConstructor()
IClassDefinition
getConstructor
in interface IClassDefinition
IFunctionDefinition
representing the constructor.public IClassDefinition resolveHostComponent(ICompilerProject project)
IClassDefinition
IClassDefinition
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 IClassDefinition
project
- 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 static boolean vectorInstanceOfCheck(ITypeDefinition base, ITypeDefinition derived)
This method aliases the Vector$XXXX where XXXX is double, uint, or int to
Vector.
base
- ITypeDefinition
for the base type in the instanceOf
check.derived
- ITypeDefinition
for the dervied type in the
instanceOf check.public boolean isInProject(ICompilerProject project)
IDefinition
isInProject
in interface IDefinition
isInProject
in class DefinitionBase
public static IClassDefinition lookupVectorImplClass(ICompilerProject project, String baseName)
public void updateBaseClass(String changedVectorImplClass)
AppliedVectorDefinition
if the
vector base name of the base class matches the base name of the vector
implementation class that has changed.changedVectorImplClass
- base name of the vector implementation
class that has changed.Copyright © 2016 The Apache Software Foundation. All rights reserved.