public abstract class ScopeView extends ASScope
ASScopeBase.FilteredCollection<T>
EMPTY_USE_ARRAY, scopedNodeRef
allNamespacesSet, definitionStore
Modifier and Type | Method and Description |
---|---|
void |
addDefinition(IDefinition d)
Adds the specified definition to this scope.
|
void |
addImplicitOpenNamespaces(CompilerProject compilerProject,
Set<INamespaceDefinition> result) |
void |
addImport(String target) |
void |
addLocalImportsToNamespaceSet(IWorkspace workspace,
Set<INamespaceDefinition> namespaceSet)
Adds
INamespaceDefinition 's for each import in this scope to the
specified namespace set. |
void |
addNamespaceDirective(NamespaceDefinition.INamespaceDirective directive) |
void |
addUseDirective(NamespaceDefinition.IUseNamespaceDirective useDirective) |
void |
getAllLocalProperties(CompilerProject project,
Collection<IDefinition> defs,
Set<INamespaceDefinition> namespaceSet,
INamespaceDefinition extraNamespace)
Adds all local definitions from this scope to the specified collections
of definitions that have a namespace qualifier in the specified
definition set.
|
void |
getAllPropertiesForMemberAccess(CompilerProject project,
Collection<IDefinition> defs,
Set<INamespaceDefinition> namespaceSet)
Adds all definitions ( including definitions from base types ) in the
current scope to the specified collections of definitions that have a
namespace qualifier in the specified definition set, when looking for
definitions through a member access.
|
void |
getAllPropertiesForScopeChain(CompilerProject project,
Collection<IDefinition> defs,
Set<INamespaceDefinition> namespaceSet)
Adds all definitions ( including definitions from base types ) in the
current scope to the specified collections of definitions that have a
namespace qualifier in the specified definition set, when looking for
definitions in the scope chain.
|
ScopedDefinitionBase |
getContainingDefinition()
Get's the
ScopedDefinitionBase that contains this scope. |
String |
getContainingSourcePath(String baseName,
ICompilerProject project) |
ScopedDefinitionBase |
getDefinition()
Gets the scoped definition that produced this scope.
|
Set<INamespaceDefinition> |
getExplicitImportQualifiers(CompilerProject project,
String name)
Return the additional namespaces for a reference, if the name has been
explicitly imported.
|
NamespaceDefinition.INamespaceDirective |
getFirstNamespaceDirective()
Gets the first namespace definition or use namespace directive in the
scope.
|
IDefinitionSet |
getLocalDefinitionSetByName(String name)
Gets the set of definitions in this one scope that have the specified base name.
|
protected void |
getPropertyForMemberAccess(CompilerProject project,
Collection<IDefinition> defs,
String baseName,
NamespaceSetPredicate namespaceSet,
boolean findAll)
Finds all the definitions in this scope that match the specified
namespace set and base name.
|
protected void |
getPropertyForScopeChain(CompilerProject project,
Collection<IDefinition> defs,
String baseName,
NamespaceSetPredicate namespaceSet,
boolean findAll)
Implementation of getPropertyForScopeChain.
|
protected abstract org.apache.flex.compiler.internal.scopes.TypeScope.ScopeKind |
getScopeKind()
Derived classes must implement this method to report what kind of scope
they are (instance or static).
|
protected INamespaceReference[] |
getUsedNamespaces() |
boolean |
isInstanceScope() |
boolean |
isPackageName(String p)
Determine whether the string passed in is a known package name The scope
will check if the package was introduced by any of it's imports, and if
not will delegate to its containing scope.
|
boolean |
isStaticScope() |
protected boolean |
namespaceSetSameAsContainingScopeNamespaceSet() |
ASScope |
resolveSuperScope(ICompilerProject project)
Get the scope of the super class - this method will do the right thing depending on
if this scope is the instance of static scope.
|
addDependencyOnBuiltinType, addNamespacesFromContainingScope, adjustNamespaceSetForSuper, canDelegateLookupToContainingScope, compact, findProperty, findProperty, findProperty, findProperty, findProperty, findProperty, findProperty, findProperty, findPropertyQualified, findPropertyQualified, findPropertyQualified, findPropertyQualified, getContainingClass, getContainingScope, getContainingScopeExplicitImports, getFileScope, getImports, getNamespaceSet, getNamespaceSetForName, getNamespaceSetForSuper, getPropertiesByNameForMemberAccess, getPropertyByNameForMemberAccess, getPropertyForMemberAccess, getPropertyFromDef, getPropertyFromDef, getQualifiedPropertyFromDef, getQualifiedPropertyFromDef, getScopeNode, getWorkspace, hasAnyBindableDefinitions, isInWith, reconnectScopeNode, setAsContainingScopeOfAnonymousFunction, setContainingDefinition, setContainingScope, toStringHeader
addDefinitionToStore, getAllLocalDefinitions, getAllLocalDefinitionSets, getAllLocalNames, getLocalProperty, getLocalProperty, getLocalProperty, isContingentDefinitionNeeded, removeDefinition, removeDefinitionFromStore, toString, verify
protected abstract org.apache.flex.compiler.internal.scopes.TypeScope.ScopeKind getScopeKind()
protected void getPropertyForScopeChain(CompilerProject project, Collection<IDefinition> defs, String baseName, NamespaceSetPredicate namespaceSet, boolean findAll)
ASScope
Collection
passed in.getPropertyForScopeChain
in class ASScope
project
- CompilerProject
to resolve things indefs
- The Collection
to add the results tobaseName
- The name of the definition to findnamespaceSet
- the NamespaceSetPredicate
to use if the namespace set needs to be adjusted
during lookupprotected void getPropertyForMemberAccess(CompilerProject project, Collection<IDefinition> defs, String baseName, NamespaceSetPredicate namespaceSet, boolean findAll)
ASScope
This version of the method expects that the Collection passed in will implement
whatever filtering is necessary, other than filtering based on the base name.
For most cases, this means the Collection will be an ASScopeBase.FilteredCollection
with a NamespaceSetPredicate
.
The NamespaceSetPredicate
must also be passed down as some name resolution
may need it to apply extra namespaces (i.e. deal with protected namespaces)
If this scope is not for a class or interface definition then only definitions in this scope are considered.
If this scope is for a class or interface definition then definitions in this scope and the scope for any implemented or extended interfaces and classes are also considered. Unless findAll is true, then this function returns as soon as one or more definitions has been found that match the namespace set and base name.
getPropertyForMemberAccess
in class ASScope
project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.defs
- Collection of IDefinition
's to add found definitions
to. This collection must perform any necessary filtering of results, other than filtering
based on the baseName.baseName
- The name of the definition(s) to find.namespaceSet
- The NamespaceSetPredicate
which the name resolution code
can use to modify the namespace set as necessary.findAll
- If true find all match definitions that match the baseName
and namespace set not just those in the first scope that had one or more
matches.public void getAllPropertiesForScopeChain(CompilerProject project, Collection<IDefinition> defs, Set<INamespaceDefinition> namespaceSet)
ASScope
getAllPropertiesForScopeChain
in class ASScope
project
- CompilerProject
used to resolve reference to
definitions outside of the ICompilationUnit
that contains this
scope.defs
- Collection that found IDefinition
's are added to.namespaceSet
- Namespace set in which the qualifier of any matching
definition must exist to be considered a match.public void getAllPropertiesForMemberAccess(CompilerProject project, Collection<IDefinition> defs, Set<INamespaceDefinition> namespaceSet)
ASScope
getAllPropertiesForMemberAccess
in class ASScope
project
- CompilerProject
used to resolve reference to
definitions outside of the ICompilationUnit
that contains this
scope.defs
- Collection that found IDefinition
's are added to.namespaceSet
- Namespace set in which the qualifier of any matching
definition must exist to be considered a match.public final void getAllLocalProperties(CompilerProject project, Collection<IDefinition> defs, Set<INamespaceDefinition> namespaceSet, INamespaceDefinition extraNamespace)
ASScopeBase
getAllLocalProperties
in class ASScopeBase
project
- CompilerProject
used to resolve reference to
definitions outside of the ICompilationUnit
that contains this
scope.defs
- Collection that found IDefinition
's are added to.namespaceSet
- Namespace set in which the qualifier of any matching
definition must exist to be considered a match.extraNamespace
- A single extra INamespaceDefinition
that is
considered part of the namespace set by this method. This is used when
resolving protected definitions in a class scope.protected boolean namespaceSetSameAsContainingScopeNamespaceSet()
namespaceSetSameAsContainingScopeNamespaceSet
in class ASScope
public void addImplicitOpenNamespaces(CompilerProject compilerProject, Set<INamespaceDefinition> result)
addImplicitOpenNamespaces
in class ASScope
public void addDefinition(IDefinition d)
ASScopeBase
addDefinition
in class ASScopeBase
d
- The IDefinition
to be added.public ScopedDefinitionBase getDefinition()
IASScope
getDefinition
in interface IASScope
getDefinition
in class ASScope
IScopedDefinition
that contains this scope.public IDefinitionSet getLocalDefinitionSetByName(String name)
IASScope
getLocalDefinitionSetByName
in interface IASScope
getLocalDefinitionSetByName
in class ASScopeBase
name
- A String specifying a base name.IDefinitionSet
containing definitions with that base name,
or null
if there are no such definitions.public String getContainingSourcePath(String baseName, ICompilerProject project)
getContainingSourcePath
in class ASScope
public void addLocalImportsToNamespaceSet(IWorkspace workspace, Set<INamespaceDefinition> namespaceSet)
ASScope
INamespaceDefinition
's for each import in this scope to the
specified namespace set.addLocalImportsToNamespaceSet
in class ASScope
workspace
- IWorkspace
used to construct
INamespaceDefinition
's for imported packages.namespaceSet
- Namespace set to add namespaces to.public Set<INamespaceDefinition> getExplicitImportQualifiers(CompilerProject project, String name)
ASScope
getExplicitImportQualifiers
in class ASScope
project
- CompilerProject to use to resolve the package INamespacesname
- The name of the referenceprotected INamespaceReference[] getUsedNamespaces()
getUsedNamespaces
in class ASScope
public void addUseDirective(NamespaceDefinition.IUseNamespaceDirective useDirective)
addUseDirective
in class ASScope
public void addNamespaceDirective(NamespaceDefinition.INamespaceDirective directive)
addNamespaceDirective
in class ASScope
public NamespaceDefinition.INamespaceDirective getFirstNamespaceDirective()
getFirstNamespaceDirective
in class ASScope
public final ScopedDefinitionBase getContainingDefinition()
ASScope
ScopedDefinitionBase
that contains this scope. This
method differs from ASScope.getDefinition()
in that this method will
walk up the scope chain.getContainingDefinition
in class ASScope
ScopedDefinitionBase
that contains this scopepublic final boolean isPackageName(String p)
ASScope
isPackageName
in class ASScope
p
- the string to testpublic boolean isInstanceScope()
public boolean isStaticScope()
public ASScope resolveSuperScope(ICompilerProject project)
project
- the Project to resolve things inCopyright © 2016 The Apache Software Foundation. All rights reserved.