public abstract class ASScope extends ASScopeBase
ASScopeBase.FilteredCollection<T>
Modifier and Type | Field and Description |
---|---|
protected static NamespaceDefinition.IUseNamespaceDirective[] |
EMPTY_USE_ARRAY |
protected NodeReference |
scopedNodeRef
Weak ref back to the Block node to which this scope belongs TODO: Remove
once code model clients don't depend on this anymore
|
allNamespacesSet, definitionStore
Constructor and Description |
---|
ASScope(ASScope containingScope) |
ASScope(ASScope containingScope,
ScopedBlockNode block)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addDependencyOnBuiltinType(ICompilerProject project,
IASLanguageConstants.BuiltinType builtinType,
DependencyType dependencyType)
Add a dependency to the given builtintype, from the compilation unit which contains 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) |
protected void |
addNamespacesFromContainingScope(CompilerProject compilerProject,
Set<INamespaceDefinition> result)
Add the open namespaces from the containing scope to the namespace set passed in
|
void |
addUseDirective(NamespaceDefinition.IUseNamespaceDirective useDirective) |
Set<INamespaceDefinition> |
adjustNamespaceSetForSuper(IDefinition superDef,
Set<INamespaceDefinition> nsSet)
Adjust the namespace set passed in so it's the right set for a super
access.
|
protected boolean |
canDelegateLookupToContainingScope(String name)
Is it ok to skip this scope, and just ask the containing scope to perform
the lookup.
|
void |
compact()
Compact the ArrayLists in this scope (so that they don't take up as much
space)
|
protected void |
findProperty(Collection<IDefinition> accumulator,
CompilerProject project,
String baseName,
NamespaceSetPredicate nsPred,
DependencyType dt,
boolean findAll)
This is the implementation of the various
findproperty() methods. |
void |
findProperty(Collection<IDefinition> accumulator,
CompilerProject project,
String baseName,
Set<INamespaceDefinition> namespaceSet,
DependencyType dt,
boolean findAll)
This is the core
findproperty() method. |
List<IDefinition> |
findProperty(CompilerProject project,
String baseName,
com.google.common.base.Predicate<IDefinition> additional,
Set<INamespaceDefinition> namespaceSet,
DependencyType dt)
Version of findProperty that determine the results based on the namespace set passed in,
along with any additional constraints passed in via the
Predicate . |
List<IDefinition> |
findProperty(CompilerProject project,
String baseName,
Set<INamespaceDefinition> namespaceSet,
DependencyType dt)
This is called by
ASScopeCache when there was a cache miss. |
IDefinition |
findProperty(ICompilerProject project,
String baseName,
DependencyType dt)
The main public entry point for the findprop operation in the compiler.
|
IDefinition |
findProperty(ICompilerProject project,
String baseName,
DependencyType dt,
boolean canEscapeWith)
The main public entry point for the findprop operation in the compiler.
|
IDefinition |
findProperty(ICompilerProject project,
String baseName,
com.google.common.base.Predicate<IDefinition> additional,
DependencyType dt,
boolean canEscapeWith)
An alternate entry point for findprop operations.
|
IDefinition |
findProperty(ICompilerProject project,
String baseName,
com.google.common.base.Predicate<IDefinition> additional,
Set<INamespaceDefinition> nsSet,
DependencyType dt,
boolean canEscapeWith) |
IDefinition |
findPropertyQualified(ICompilerProject project,
INamespaceDefinition qual,
String baseName,
DependencyType dt)
The main public entry point for the findprop operation in the compiler
with an explicit qualifier namespace.
|
IDefinition |
findPropertyQualified(ICompilerProject project,
INamespaceDefinition qual,
String baseName,
DependencyType dt,
boolean canEscapeWith)
The main public entry point for the findprop operation in the compiler
with an explicit qualifier namespace.
|
IDefinition |
findPropertyQualified(ICompilerProject project,
IQualifiers qual,
String baseName,
DependencyType dt,
boolean canEscapeWith)
The main public entry point for the findprop operation in the compiler
with an explicit set of qualifier namespaces.
|
IDefinition |
findPropertyQualified(ICompilerProject project,
com.google.common.base.Predicate<IDefinition> additional,
INamespaceDefinition qual,
String baseName,
DependencyType dt)
The main public entry point for the findprop operation in the compiler
with an explicit qualifier namespace.
|
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.
|
ClassDefinitionBase |
getContainingClass()
Helper method to return the ClassDefinition this scope is inside of, if
there is one.
|
IScopedDefinition |
getContainingDefinition()
Get's the
ScopedDefinitionBase that contains this scope. |
ASScope |
getContainingScope()
Gets the scope that lexically contains this scope.
|
protected void |
getContainingScopeExplicitImports(CompilerProject project,
String name,
Set<INamespaceDefinition> nsSet)
Get the additional namespaces for a reference, if the name has been explicitly imported in
a containing scope
|
String |
getContainingSourcePath(String qName,
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.
|
ASFileScope |
getFileScope() |
NamespaceDefinition.INamespaceDirective |
getFirstNamespaceDirective()
Gets the first namespace definition or use namespace directive in the
scope.
|
String[] |
getImports() |
Set<INamespaceDefinition> |
getNamespaceSet(ICompilerProject project)
Computes and returns the namespace set for this scope.
|
Set<INamespaceDefinition> |
getNamespaceSetForName(ICompilerProject project,
String name)
Calculate the namespace set to use to resolve name.
|
Set<INamespaceDefinition> |
getNamespaceSetForSuper(ICompilerProject project,
IDefinition superDef)
Helper method to get the namespace set to use for a super reference.
|
List<IDefinition> |
getPropertiesByNameForMemberAccess(CompilerProject project,
String memberName,
Set<INamespaceDefinition> namespaceSet)
Gets all definitions (including definitions from base types) that have
the specified name to the specified collections of definitions that have
a namespace qualifier in the specified definition set, when looking for
definitions through a member access.
|
IDefinition |
getPropertyByNameForMemberAccess(CompilerProject project,
String memberName,
Set<INamespaceDefinition> namespaceSet)
Gets the definition (including definitions from base types) that has
the specified name and that has a namespace qualifier in the specified
namespace set, when looking for definitions through a member access.
|
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.
|
void |
getPropertyForMemberAccess(CompilerProject project,
Collection<IDefinition> defs,
String baseName,
Set<INamespaceDefinition> 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.
|
IDefinition |
getPropertyFromDef(ICompilerProject project,
IDefinition def,
String name,
boolean isSuperRef)
Find a property in an IDefinition, using the open namespaces & packages
of this scope.
|
IDefinition |
getPropertyFromDef(ICompilerProject project,
IDefinition def,
String name,
com.google.common.base.Predicate<IDefinition> additional,
boolean isSuperRef)
Find a property in an IDefinition, using the open namespaces & packages
of this scope, and any additional constraints that are passed in as a
Predicate . |
IDefinition |
getQualifiedPropertyFromDef(ICompilerProject project,
IDefinition def,
String name,
INamespaceDefinition qualifier,
boolean isSuperRef)
Find a property in an IDefinition, using the namespace passed in as the
qualifier.
|
IDefinition |
getQualifiedPropertyFromDef(ICompilerProject project,
IDefinition def,
String name,
IQualifiers qualifiers,
boolean isSuperRef)
Find a property in an IDefinition, using the qualifiers passed in to provide the namespace set.
|
IScopedNode |
getScopeNode()
Gets the scoped node corresponding to this scope.
|
protected INamespaceReference[] |
getUsedNamespaces() |
IWorkspace |
getWorkspace()
Get's the
IWorkspace in which this ASScope lives. |
boolean |
hasAnyBindableDefinitions()
Determine if any of the definitions in this scope are Bindable
|
boolean |
isInWith()
Is this scope inside a with scope.
|
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.
|
protected boolean |
namespaceSetSameAsContainingScopeNamespaceSet() |
void |
reconnectScopeNode(IScopedNode node)
Re-connects this scope to the syntax tree node that corresponds to this
scope.
|
void |
setAsContainingScopeOfAnonymousFunction(FunctionDefinition anonymousFunction)
Makes this scope be the containing scope of the specified anonymous
function.
|
void |
setContainingDefinition(ScopedDefinitionBase value) |
void |
setContainingScope(ASScope containingScope)
Sets the scope which lexically contains this scope.
|
protected String |
toStringHeader()
For debugging only.
|
addDefinition, addDefinitionToStore, getAllLocalDefinitions, getAllLocalDefinitionSets, getAllLocalNames, getAllLocalProperties, getLocalDefinitionSetByName, getLocalProperty, getLocalProperty, getLocalProperty, isContingentDefinitionNeeded, removeDefinition, removeDefinitionFromStore, toString, verify
protected static final NamespaceDefinition.IUseNamespaceDirective[] EMPTY_USE_ARRAY
protected NodeReference scopedNodeRef
public ASScope(ASScope containingScope, ScopedBlockNode block)
block
- block node to which this scope belongspublic ASScope(ASScope containingScope)
public void setContainingScope(ASScope containingScope)
containingScope
- The containing scope.public void compact()
compact
in class ASScopeBase
public void addNamespaceDirective(NamespaceDefinition.INamespaceDirective directive)
public void addUseDirective(NamespaceDefinition.IUseNamespaceDirective useDirective)
public void addImport(String target)
public ASScope getContainingScope()
IASScope
IASScope
that contains this scope,
or null
if there is no such scope.public void reconnectScopeNode(IScopedNode node)
node
- IScopedNode
that corresponds to this scope.public IScopedNode getScopeNode()
IASScope
getScopeNode
in interface IASScope
getScopeNode
in class ASScopeBase
IScopedNode
corresponding to this scope.public String[] getImports()
public ScopedDefinitionBase getDefinition()
IASScope
getDefinition
in interface IASScope
getDefinition
in class ASScopeBase
IScopedDefinition
that contains this scope.public void setContainingDefinition(ScopedDefinitionBase value)
protected String toStringHeader()
toStringHeader
in class ASScopeBase
public boolean isPackageName(String p)
p
- the string to testpublic Set<INamespaceDefinition> getExplicitImportQualifiers(CompilerProject project, String name)
project
- CompilerProject to use to resolve the package INamespacesname
- The name of the referenceprotected void getContainingScopeExplicitImports(CompilerProject project, String name, Set<INamespaceDefinition> nsSet)
project
- the active projectname
- the name of the referencensSet
- the namespace set to add the namespaces toprotected INamespaceReference[] getUsedNamespaces()
public NamespaceDefinition.INamespaceDirective getFirstNamespaceDirective()
public void addLocalImportsToNamespaceSet(IWorkspace workspace, Set<INamespaceDefinition> namespaceSet)
INamespaceDefinition
's for each import in this scope to the
specified namespace set.workspace
- IWorkspace
used to construct
INamespaceDefinition
's for imported packages.namespaceSet
- Namespace set to add namespaces to.public Set<INamespaceDefinition> getNamespaceSetForName(ICompilerProject project, String name)
project
- The compiler projectname
- A name.protected boolean namespaceSetSameAsContainingScopeNamespaceSet()
public Set<INamespaceDefinition> getNamespaceSet(ICompilerProject project)
The returned set should not be modified.
project
- The compiler project.protected void addNamespacesFromContainingScope(CompilerProject compilerProject, Set<INamespaceDefinition> result)
compilerProject
- the active projectresult
- the Namespace Set to add namespaces topublic void addImplicitOpenNamespaces(CompilerProject compilerProject, Set<INamespaceDefinition> result)
public void getAllPropertiesForScopeChain(CompilerProject project, Collection<IDefinition> defs, Set<INamespaceDefinition> namespaceSet)
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)
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 List<IDefinition> getPropertiesByNameForMemberAccess(CompilerProject project, String memberName, Set<INamespaceDefinition> namespaceSet)
project
- CompilerProject
used to resolve reference to
definitions outside of the ICompilationUnit
that contains this
scope.memberName
- the name of the desired definition(s).namespaceSet
- Namespace set in which the qualifier of any matching
definition must exist to be considered a match.public IDefinition getPropertyByNameForMemberAccess(CompilerProject project, String memberName, Set<INamespaceDefinition> namespaceSet)
project
- CompilerProject
used to resolve reference to
definitions outside of the ICompilationUnit
that contains this
scope.memberName
- the name of the desired definition(s).namespaceSet
- Namespace set in which the qualifier of any matching
definition must exist to be considered a match.public void getPropertyForMemberAccess(CompilerProject project, Collection<IDefinition> defs, String baseName, Set<INamespaceDefinition> namespaceSet, boolean findAll)
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.
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.baseName
- The name of the definition(s) to find.namespaceSet
- The namespace set in which a found definition's
qualifier must be in.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.protected void getPropertyForMemberAccess(CompilerProject project, Collection<IDefinition> defs, String baseName, NamespaceSetPredicate namespaceSet, boolean findAll)
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.
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 IDefinition getPropertyFromDef(ICompilerProject project, IDefinition def, String name, boolean isSuperRef)
project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.def
- The definition to resolve the property inname
- The name of the definition to findisSuperRef
- whether this lookup is through a 'super' reference - if
it is then the namespace set will be adjusted to use the base classes
protected namespace instead of the containing classes protected namespacepublic IDefinition getPropertyFromDef(ICompilerProject project, IDefinition def, String name, com.google.common.base.Predicate<IDefinition> additional, boolean isSuperRef)
Predicate
.project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.def
- The definition to resolve the property inname
- The name of the definition to findadditional
- A Predicate
that will perform additional filtering of the results.
This Predicate
will run before any namespace set checking.isSuperRef
- whether this lookup is through a 'super' reference - if
it is then the namespace set will be adjusted to use the base classes
protected namespace instead of the containing classes protected namespacepublic IDefinition getQualifiedPropertyFromDef(ICompilerProject project, IDefinition def, String name, INamespaceDefinition qualifier, boolean isSuperRef)
project
- ICompilerProject
whose symbol table is used to
resolve references.def
- The definition to resolve the property inname
- The name of the definition to findqualifier
- The namespace to us to look up nameisSuperRef
- whether this lookup is through a 'super' reference - if
it is then the namespace set will be adjusted to use the base classes
protected namespace instead of the containing classes protected namespacepublic IDefinition getQualifiedPropertyFromDef(ICompilerProject project, IDefinition def, String name, IQualifiers qualifiers, boolean isSuperRef)
project
- ICompilerProject
whose symbol table is used to
resolve references.def
- The definition to resolve the property inname
- The name of the definition to findqualifiers
- The namespace(s) to us to look up nameisSuperRef
- whether this lookup is through a 'super' reference - if
it is then the namespace set will be adjusted to use the base classes
protected namespace instead of the containing classes protected namespaceprotected void getPropertyForScopeChain(CompilerProject project, Collection<IDefinition> defs, String baseName, NamespaceSetPredicate namespaceSet, boolean findAll)
Collection
passed in.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 lookuppublic List<IDefinition> findProperty(CompilerProject project, String baseName, Set<INamespaceDefinition> namespaceSet, DependencyType dt)
ASScopeCache
when there was a cache miss.project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.baseName
- base name of the property we are looking for.namespaceSet
- Namespace set in which the qualifier of any found
definition must found.dt
- The type of dependency that should be added to the dependency
graph when resolving this reference across a compilation unit boundary.IDefinition
's matched by the namespace set
and base name.public List<IDefinition> findProperty(CompilerProject project, String baseName, com.google.common.base.Predicate<IDefinition> additional, Set<INamespaceDefinition> namespaceSet, DependencyType dt)
Predicate
.project
- The CompilerProject
to resolve things inbaseName
- The name to findadditional
- Any additional constraints on the lookup. This predicate will
run before any namespace checking occurs.namespaceSet
- The Namespace set to use for the lookupdt
- The dependency type to introduce if this resolves to something from
another compilation unitpublic void findProperty(Collection<IDefinition> accumulator, CompilerProject project, String baseName, Set<INamespaceDefinition> namespaceSet, DependencyType dt, boolean findAll)
findproperty()
method. It implements the
equivalent of the findprop
AVM instruction in Falcon.
The algorithm searches up the scope chain, starting with this scope, for definitions with the specified base name and namespace set.
After the file scope, the project scope is searched if necessary. If definitions are found in the project scope, a dependency is created on the compilation unit that produced them.
If the findAll
parameter is false
, the search
stops with the first scope that has one or more matching definition; if
it is true
, the search continues to find all matching
definitions in the entire chain, including the project scope.
accumulator
- Collection to which definitions that match the
namespace set and base name are added.project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.baseName
- base name of the property we are looking for.namespaceSet
- Namespace set in which the qualifier of any found
definition must found.dt
- The type of dependency that should be added to the dependency
graph when resolving this reference across a compilation unit boundary.findAll
- If true, then find all definitions that match the
namespace set and base name, not just those from the first scope with a
single match.protected void findProperty(Collection<IDefinition> accumulator, CompilerProject project, String baseName, NamespaceSetPredicate nsPred, DependencyType dt, boolean findAll)
findproperty()
methods. It implements the
equivalent of the findprop
AVM instruction in Falcon.
The algorithm searches up the scope chain, starting with this scope, for definitions with the specified base name.
If any additional constraints are required (e.g. filtering based on the namespace set), then
callers should pass in an ASScopeBase.FilteredCollection
as the accumulator that will implement those
constraints. For the common case, the accumulator will be an ASScopeBase.FilteredCollection
with a NamespaceSetPredicate
.
After the file scope, the project scope is searched if necessary. If definitions are found in the project scope, a dependency is created on the compilation unit that produced them.
If the findAll
parameter is false
, the search
stops with the first scope that has one or more matching definition; if
it is true
, the search continues to find all matching
definitions in the entire chain, including the project scope.
accumulator
- Collection to which definitions that match the
base name are added.project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.baseName
- base name of the property we are looking for.nsPred
- The NamespaceSetPredicate
, if one is being used, that the lookup
can modify as it walks up the scope chain (necessary to handle protected correctly).dt
- The type of dependency that should be added to the dependency
graph when resolving this reference across a compilation unit boundary.findAll
- If true, then find all definitions that match the
namespace set and base name, not just those from the first scope with a
single match.public boolean isInWith()
public IDefinition findProperty(ICompilerProject project, String baseName, DependencyType dt)
ASScopeCache
to improve performance.project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.baseName
- base name of the property we are looking for.dt
- The type of dependency that should be added to the dependency
graph when resolving this reference across a compilation unit boundary.IDefinition
to which the specified base name
resolves to in this scope, or null. Null is returned when no definition
is found and when more than one definition is found.public IDefinition findProperty(ICompilerProject project, String baseName, DependencyType dt, boolean canEscapeWith)
ASScopeCache
to improve performance.project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.baseName
- base name of the property we are looking for.dt
- The type of dependency that should be added to the dependency
graph when resolving this reference across a compilation unit boundary.canEscapeWith
- should this lookup find definitions that occur
outside of a containing with scopeIDefinition
to which the specified base name
resolves to in this scope, or null. Null is returned when no definition
is found and when more than one definition is found.public IDefinition findProperty(ICompilerProject project, String baseName, com.google.common.base.Predicate<IDefinition> additional, DependencyType dt, boolean canEscapeWith)
project
- the active projectbaseName
- base name of the property we're looking foradditional
- A Predicate that performs custom filtering on the resultsdt
- The dependency type that should be added to the dependency graph
when resolving this reference across a compilation boundarycanEscapeWith
- should this lookup find definitions that occur outside of a containing with scopeIDefinition
to which the specified base name resolves to in this
scope, given the additional constraints supplied by the additional Predicate.public IDefinition findProperty(ICompilerProject project, String baseName, com.google.common.base.Predicate<IDefinition> additional, Set<INamespaceDefinition> nsSet, DependencyType dt, boolean canEscapeWith)
protected boolean canDelegateLookupToContainingScope(String name)
public IDefinition findPropertyQualified(ICompilerProject project, INamespaceDefinition qual, String baseName, DependencyType dt)
ASScopeCache
to improve performance.project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.qual
- INamespaceDefinition
which must match the qualifier
namespace of the found IDefinition
.baseName
- base name of the property we are looking for.dt
- The type of dependency that should be added to the dependency
graph when resolving this reference across a compilation unit boundary.IDefinition
to which the specified qualifier and
base name resolves to in this scope, or null. Null is returned when no
definition is found and when more than one definition is found.public IDefinition findPropertyQualified(ICompilerProject project, com.google.common.base.Predicate<IDefinition> additional, INamespaceDefinition qual, String baseName, DependencyType dt)
ASScopeCache
to improve performance.project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.qual
- INamespaceDefinition
which must match the qualifier
namespace of the found IDefinition
.baseName
- base name of the property we are looking for.dt
- The type of dependency that should be added to the dependency
graph when resolving this reference across a compilation unit boundary.IDefinition
to which the specified qualifier and
base name resolves to in this scope, or null. Null is returned when no
definition is found and when more than one definition is found.public IDefinition findPropertyQualified(ICompilerProject project, INamespaceDefinition qual, String baseName, DependencyType dt, boolean canEscapeWith)
ASScopeCache
to improve performance.project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.qual
- The qualifier(s) to use to lookup the property.baseName
- base name of the property we are looking for.canEscapeWith
- should this lookup find definitions that occur
outside of a containing with scopedt
- The type of dependency that should be added to the dependency
graph when resolving this reference across a compilation unit boundary.IDefinition
to which the specified qualifier and
base name resolves to in this scope, or null. Null is returned when no
definition is found and when more than one definition is found.public IDefinition findPropertyQualified(ICompilerProject project, IQualifiers qual, String baseName, DependencyType dt, boolean canEscapeWith)
ASScopeCache
to improve performance.project
- ICompilerProject
whose symbol table is used to
resolve namespace references in the "use namespace" set this scope.baseName
- base name of the property we are looking for.qual
- The qualifier(s) to use to lookup the property.canEscapeWith
- should this lookup find definitions that occur
outside of a containing with scopedt
- The type of dependency that should be added to the dependency
graph when resolving this reference across a compilation unit boundary.IDefinition
to which the specified qualifier and
base name resolves to in this scope, or null. Null is returned when no
definition is found and when more than one definition is found.public Set<INamespaceDefinition> getNamespaceSetForSuper(ICompilerProject project, IDefinition superDef)
project
- project used to resolve namespacessuperDef
- the IDefinition representing the base classpublic Set<INamespaceDefinition> adjustNamespaceSetForSuper(IDefinition superDef, Set<INamespaceDefinition> nsSet)
superDef
- the IDefinition representing the base classnsSet
- the namespace set to adjustpublic ClassDefinitionBase getContainingClass()
public ASFileScope getFileScope()
public IWorkspace getWorkspace()
IWorkspace
in which this ASScope
lives.IWorkspace
in which this ASScope
lives.public String getContainingSourcePath(String qName, ICompilerProject project)
public boolean hasAnyBindableDefinitions()
public IScopedDefinition getContainingDefinition()
ScopedDefinitionBase
that contains this scope. This
method differs from getDefinition()
in that this method will
walk up the scope chain.ScopedDefinitionBase
that contains this scopepublic void setAsContainingScopeOfAnonymousFunction(FunctionDefinition anonymousFunction)
public void addDependencyOnBuiltinType(ICompilerProject project, IASLanguageConstants.BuiltinType builtinType, DependencyType dependencyType)
project
- the active projectbuiltinType
- the builtin type to depend ondependencyType
- the type of dependency to addCopyright © 2016 The Apache Software Foundation. All rights reserved.