public abstract class NamespaceDefinition extends DefinitionBase implements INamespaceDefinition, INamespaceReference
The interfaces may have been declared with the namespace
keyword
or may be ones that are implicit in the ActionScript language.
After a namespace definition is in the symbol table, it should always be
accessed through the read-only INamespaceDefinition
interface.
Modifier and Type | Class and Description |
---|---|
static interface |
NamespaceDefinition.INamepaceDeclarationDirective
Implemented by namespace definitions constructed from namespace
definition directives found in source code.
|
static interface |
NamespaceDefinition.INamespaceDirective
Interface implemented by use namespace directives and by namespace
declarations.
|
static interface |
NamespaceDefinition.IUseNamespaceDirective
Implemented by all namespace references from constructed use namespace
directives found in source code.
|
INamespaceDefinition.IAnyNamespaceDefinition, INamespaceDefinition.ICodeModelImplicitDefinitionNamespaceDefinition, INamespaceDefinition.IFilePrivateNamespaceDefinition, INamespaceDefinition.IInterfaceNamespaceDefinition, INamespaceDefinition.IInternalNamespaceDefinition, INamespaceDefinition.ILanguageNamespaceDefinition, INamespaceDefinition.INamespaceWithPackageName, INamespaceDefinition.IPrivateNamespaceDefinition, INamespaceDefinition.IProtectedNamespaceDefinition, INamespaceDefinition.IPublicNamespaceDefinition, INamespaceDefinition.IStaticProtectedNamespaceDefinition, INamespaceDefinition.NamespaceClassification
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
Modifier and Type | Method and Description |
---|---|
static void |
addUseNamespaceDirectiveToScope(IASScope scope,
INamespaceDecorationNode node) |
static INamespaceDefinition.IFilePrivateNamespaceDefinition |
createFilePrivateNamespaceDefinition(String uri)
Create a new file private namespace definition.
|
static INamespaceDefinition.IInterfaceNamespaceDefinition |
createInterfaceNamespaceDefinition(InterfaceDefinition owningInterface)
Create a new interface namespace definition for an interface
|
static INamespaceDefinition.IInternalNamespaceDefinition |
createInternalNamespaceDefinition(String owningPackageName)
Create a new internal namespace definition for a package.
|
static NamespaceDefinition |
createNamespaceDefinition(Namespace ns) |
static NamespaceDefinition |
createNamespaceDefinition(String name,
Namespace ns) |
static NamespaceDefinition |
createNamespaceDefintionDirective(INamespaceReference qualifierNamespaceRef,
IASScope scope,
String name,
String uri,
INamespaceReference initializer)
Create a new usder defined namespace definition.
|
static INamespaceReference |
createNamespaceReference(ASScope scope,
String baseName,
INamespaceReference qualifier)
Create a new UserDefinedNamespaceReference with the given scope, baseName, and qualifier
|
static INamespaceReference |
createNamespaceReference(ASScope scope,
String baseName,
INamespaceReference qualifier,
IReference base)
Create a new UserDefinedNamespaceReference with the given scope, baseName, qualifier, and base reference
|
static INamespaceReference |
createNamespaceReference(IASScope scope,
INamespaceDecorationNode node) |
static INamespaceReference |
createNamespaceReference(IASScope scope,
INamespaceDecorationNode node,
boolean isStatic) |
static Collection<INamespaceReference> |
createNamespaceReferencesForQualifier(ASScope scope,
INamespaceDecorationNode node)
Generate a collection of INamespaceReferences that are all the namespace references that the given
INamespaceDecorationNode refers to, when that node is used as the qualifier in an expression, such as:
qualifer::expr
This returns a collection because some qualifiers (public, protected) may actually refer to multiple
namespaces depending on the context where they are used
|
static INamespaceDefinition.IPublicNamespaceDefinition |
createPackagePublicNamespaceDefinition(String packageName) |
static INamespaceDefinition.IPrivateNamespaceDefinition |
createPrivateNamespaceDefinition(String uri)
Create a new private namespace definition.
|
static INamespaceDefinition.IProtectedNamespaceDefinition |
createProtectedNamespaceDefinition(String uri)
Create a new protected namespace definition.
|
static INamespaceDefinition.IStaticProtectedNamespaceDefinition |
createStaticProtectedNamespaceDefinition(String uri) |
static NamespaceDefinition |
createUserDefinedNamespace(String name,
String uri)
Create a new user defined namespace definition.
|
boolean |
equals(INamespaceDefinition ns) |
boolean |
equals(Object obj) |
Namespace |
getAETNamespace()
Gets the
Namespace object for this INamespaceDefinition
needed by the code generator to generate an ABC namespace using the AET
library. |
static INamespaceReference |
getAnyNamespaceReference() |
static INamespaceDefinition |
getAS3NamespaceDefinition() |
static INamespaceReference |
getAS3NamespaceReference() |
String |
getBaseName()
Gets the base (i.e., unqualified) name of this definition.
|
static INamespaceDefinition.ICodeModelImplicitDefinitionNamespaceDefinition |
getCodeModelImplicitDefinitionNamespace()
We have a single global private namespace, in which we can place implicit
code model definitions that only exist for code model compatibility. this
and super definitions are in this namespace.
|
static INamespaceDefinition.ILanguageNamespaceDefinition |
getDefaultNamespaceDefinition(IASScope scope) |
INamespaceDefinition |
getFirst()
Get the first namespace.
|
int |
getNamespaceCount()
Gets the number of namespaces in the set.
|
Set<INamespaceDefinition> |
getNamespaceSet()
Gets the set of namespaces.
|
INamespaceNode |
getNode()
Returns the
IDefinitionNode from which this definition was
created, if the definition came from the AST for a source file. |
static INamespaceDefinition.IPublicNamespaceDefinition |
getPublicNamespaceDefinition()
Gets the single public namespace definition for the whole process.
|
String |
getURI()
Returns the optional URI associated with this namespace
|
int |
hashCode() |
boolean |
isLanguageNamespace()
Does this namespace reference refer to a builtin language namespace?
|
boolean |
isPublicOrInternalNamespace() |
boolean |
isStatic()
Is this definition marked as
static ? |
boolean |
matches(DefinitionBase node) |
static boolean |
qualifierCouldBeManyNamespaces(ASScope scope,
INamespaceDecorationNode node)
Determine if the INamespaceDecorationNode passed in could refer to more than one namespace when
used as a qualifier.
|
INamespaceDefinition |
resolveNamespaceReference(ICompilerProject project)
Resolves this namespace reference to a namespace definition.
|
static void |
setContainingDefinitionOfReference(INamespaceReference nsRef,
IDefinition containingDef)
Set the containing definition of an
INamespaceReference , if the INamespaceReference implementation
needs that information. |
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, getMetaTagsByName, getMName, getModifiers, getNameColumn, getNameEnd, getNameLine, getNamespaceReference, getNamespaceReferenceAsString, getNameStart, 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, 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, finalize, getClass, notify, notifyAll, wait, wait, wait
getNamespaceClassification
getExplicitSourceComment, hasExplicitComment
getAbsoluteEnd, getAbsoluteStart, getAllMetaTags, getAncestorOfType, 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, resolveNamespace, resolveType
resolveAETNamespace
public static INamespaceDefinition.IPublicNamespaceDefinition getPublicNamespaceDefinition()
public static INamespaceDefinition getAS3NamespaceDefinition()
public static INamespaceReference getAS3NamespaceReference()
public static INamespaceReference getAnyNamespaceReference()
public static INamespaceDefinition.ICodeModelImplicitDefinitionNamespaceDefinition getCodeModelImplicitDefinitionNamespace()
INamespaceDefinition.ICodeModelImplicitDefinitionNamespaceDefinition
for implicit code model
definitions.public static NamespaceDefinition createNamespaceDefinition(Namespace ns)
public static NamespaceDefinition createNamespaceDefinition(String name, Namespace ns)
name
- name of the namespace definition if the namespace was
specified in source code or was read from a const slot in an ABC, null
otherwise.ns
- An ABC namespace.public static INamespaceDefinition.IPrivateNamespaceDefinition createPrivateNamespaceDefinition(String uri)
public static INamespaceDefinition.IFilePrivateNamespaceDefinition createFilePrivateNamespaceDefinition(String uri)
The distinction between file private namespaces and regular private namespaces is purely for the benefit of code model clients. Once we have implemented type analysis in Falcon, CM clients may not need this distinction anymore.
public static INamespaceDefinition.IProtectedNamespaceDefinition createProtectedNamespaceDefinition(String uri)
public static INamespaceDefinition.IStaticProtectedNamespaceDefinition createStaticProtectedNamespaceDefinition(String uri)
public static INamespaceDefinition.IInternalNamespaceDefinition createInternalNamespaceDefinition(String owningPackageName)
owningPackageName
- The package definition the namespace definition
is for.public static INamespaceDefinition.IInterfaceNamespaceDefinition createInterfaceNamespaceDefinition(InterfaceDefinition owningInterface)
owningInterface
- The interface definition the namespace definition
is forpublic static INamespaceDefinition.IPublicNamespaceDefinition createPackagePublicNamespaceDefinition(String packageName)
packageName
- The name of the package for which a
INamespaceDefinition.IPublicNamespaceDefinition
should be created.INamespaceDefinition.IPublicNamespaceDefinition
for the public namespace
in the specified package.public static NamespaceDefinition createUserDefinedNamespace(String name, String uri)
public static NamespaceDefinition createNamespaceDefintionDirective(INamespaceReference qualifierNamespaceRef, IASScope scope, String name, String uri, INamespaceReference initializer)
public namespace foo = "http://foo.com";
qualifierNamespaceRef
- The INamespaceReference
that
qualifies the namespace declaration. In the example above this would be a
INamespaceReference
that resolves to the public namespace for the
containing scope.scope
- The scope in which the namespace definition occurs.name
- The name of the namespace definition. In the example above
this would be "foo".uri
- The URI initializer of the namespace declaration or null if
there is not uri specified. In the example above, this would be
"http://foo.com".initializer
- A NamespaceReference to another namespace that this namespace was initialized with
e.g.
namespace ns2 = ns1;public static INamespaceReference createNamespaceReference(IASScope scope, INamespaceDecorationNode node)
scope
- The IASScope in which the node should be resolvednode
- The INamespaceDecorationNode that represents the namespace
reference - may not be null.public static void setContainingDefinitionOfReference(INamespaceReference nsRef, IDefinition containingDef)
INamespaceReference
, if the INamespaceReference
implementation
needs that information. Currently, only a user defined namespace reference will care what its containing definition
is.nsRef
- the INamespaceReference
to set the containing definition oncontainingDef
- the IDefinition
that contains the namespace referencepublic static INamespaceReference createNamespaceReference(IASScope scope, INamespaceDecorationNode node, boolean isStatic)
scope
- The IASScope in which the node should be resolvednode
- The INamespaceDecorationNode that represents the namespace
reference - may not be null.isStatic
- whether we want to construct a namespace for a static
property - if true, and the baseName is "protected" then it will
construct a static-protected namespace instead of a protected namespacepublic static boolean qualifierCouldBeManyNamespaces(ASScope scope, INamespaceDecorationNode node)
scope
- scope to resolve things innode
- the namespace node to checkpublic static Collection<INamespaceReference> createNamespaceReferencesForQualifier(ASScope scope, INamespaceDecorationNode node)
scope
- scope where the namespace reference ocurrsnode
- the qualifier nodepublic static INamespaceReference createNamespaceReference(ASScope scope, String baseName, INamespaceReference qualifier, IReference base)
scope
- The scope to resolve inbaseName
- The base name of the namespace referencequalifier
- The qualifier of the namespace reference, eg 'foo' in 'a.foo::b'. May be null if there is
no qualifierbase
- The base reference, 'a' in 'a.b'INamespaceReference
public static INamespaceReference createNamespaceReference(ASScope scope, String baseName, INamespaceReference qualifier)
scope
- The ASScope in which the node should be resolvedbaseName
- The string that represents the name of the namespacequalifier
- An INamespaceReference for the qualifier, may be null if there is no explicit qualifierpublic static void addUseNamespaceDirectiveToScope(IASScope scope, INamespaceDecorationNode node)
scope
- The IASScope in which the node should be resolvednode
- The INamespaceDecorationNode that represents the namespace
reference - may not be null.public static INamespaceDefinition.ILanguageNamespaceDefinition getDefaultNamespaceDefinition(IASScope scope)
public String getURI()
INamespaceDefinition
getURI
in interface INamespaceDefinition
public INamespaceNode 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 interface INamespaceDefinition
getNode
in class DefinitionBase
public boolean isLanguageNamespace()
INamespaceReference
isLanguageNamespace
in interface INamespaceReference
true
if it does.public INamespaceDefinition resolveNamespaceReference(ICompilerProject project)
INamespaceReference
resolveNamespaceReference
in interface INamespaceReference
project
- ICompilerProject
whose symbol table will be used to resolve
references across ICompilationUnit
's.INamespaceDefinition
representing the definition of the namespace.public boolean matches(DefinitionBase node)
matches
in class DefinitionBase
public 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 interface INamespaceReference
getBaseName
in class DefinitionBase
public boolean isPublicOrInternalNamespace()
isPublicOrInternalNamespace
in interface INamespaceDefinition
isPublicOrInternalNamespace
in interface INamespaceReference
public int getNamespaceCount()
IQualifiers
getNamespaceCount
in interface IQualifiers
public Set<INamespaceDefinition> getNamespaceSet()
IQualifiers
getNamespaceSet
in interface IQualifiers
public INamespaceDefinition getFirst()
IQualifiers
This is an optimization to avoid the frequent construction
of temporary sets, since often an IQualifiers
will only have one namespace in it.
getFirst
in interface IQualifiers
public Namespace getAETNamespace()
Namespace
object for this INamespaceDefinition
needed by the code generator to generate an ABC namespace using the AET
library.
This method is used by the code generator to get the AET namespace from a NamespaceDefinition.
TODO We should change AET to define an interface for Namespace that this class can implement. Then this class would not need to contain an AET namespace, but would *be* an AET namespace.
Namespace
object needed by the code generatorpublic boolean equals(INamespaceDefinition ns)
equals
in interface INamespaceDefinition
public boolean isStatic()
IDefinition
static
?isStatic
in interface IDefinition
isStatic
in class DefinitionBase
true
if the definition is static
.Copyright © 2016 The Apache Software Foundation. All rights reserved.