public class ASFileScope extends ASScope implements IFileScope
ASScopeBase.FilteredCollection<T>
Modifier and Type | Field and Description |
---|---|
protected WeakReference<ICompilationUnit> |
compilationUnitReference |
protected String |
filePath
the path of the file this file scope represents
|
protected Boolean |
isEditableFile
A flag indicating whether this is an editable file (AS/MXML) or not
(SWC).
|
EMPTY_USE_ARRAY, scopedNodeRef
allNamespacesSet, definitionStore
Constructor and Description |
---|
ASFileScope(FileNode fileNode)
Constructor
|
ASFileScope(IFileSpecificationGetter fileSpecGetter,
String filePath)
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 |
addParsedFunctionBodies(FunctionNode functionNode)
Add a function node the the collection of function nodes which
have been parsed
|
void |
collectExternallyVisibleDefinitions(Collection<IDefinition> defs,
boolean includePrivateDefinitions)
Finds the definitions in this scope which could be visible to other
compilation units and adds them to a specified collection of definitions.
|
ICompilationUnit |
getCompilationUnit()
Get the
ICompilationUnit related to this ASFileScope . |
ScopedDefinitionBase |
getContainingDefinition()
Get's the
ScopedDefinitionBase that contains this scope. |
String |
getContainingPath() |
String |
getContainingSourcePath(String qName,
ICompilerProject project)
Resolve the source file path of the given definition QName.
|
INamespaceDefinition.ILanguageNamespaceDefinition |
getFilePrivateNamespaceReference() |
static Collection<String> |
getImplicitImportsForAS()
Returns the implicit imports for an ActionScript file.
|
IASNode |
getNode()
Get the IASNode this FileScope came from.
|
OffsetLookup |
getOffsetLookup() |
IWorkspace |
getWorkspace()
Get's the
IWorkspace in which this ASScope lives. |
protected boolean |
isEditableFile()
Determine whether or not this is an editable file.
|
boolean |
isPackageName(String p)
Determine if p is the name of a package - at File Scope it checks
declared package names in addition to package names introduced via import
|
boolean |
isSWC() |
protected boolean |
namespaceSetSameAsContainingScopeNamespaceSet() |
void |
removeParsedFunctionBodies(FunctionNode functionNode)
Remove a function node the the collection of function nodes which
have been parsed, when the body is discarded
|
IASNode |
reparseFile()
Re-parse the file this scope was built for.
|
boolean |
setCompilationUnit(ICompilationUnit compilationUnit)
Set the
ICompilationUnit related to this ASFileScope . |
void |
setOffsetLookup(OffsetLookup offsetLookup)
Set the
OffsetLookup utility. |
protected String |
toStringHeader()
For debugging only.
|
addImport, addLocalImportsToNamespaceSet, addNamespaceDirective, addNamespacesFromContainingScope, addUseDirective, adjustNamespaceSetForSuper, canDelegateLookupToContainingScope, compact, findProperty, findProperty, findProperty, findProperty, findProperty, findProperty, findProperty, findProperty, findPropertyQualified, findPropertyQualified, findPropertyQualified, findPropertyQualified, getAllPropertiesForMemberAccess, getAllPropertiesForScopeChain, getContainingClass, getContainingScope, getContainingScopeExplicitImports, getDefinition, getExplicitImportQualifiers, getFileScope, getFirstNamespaceDirective, getImports, getNamespaceSet, getNamespaceSetForName, getNamespaceSetForSuper, getPropertiesByNameForMemberAccess, getPropertyByNameForMemberAccess, getPropertyForMemberAccess, getPropertyForMemberAccess, getPropertyForScopeChain, getPropertyFromDef, getPropertyFromDef, getQualifiedPropertyFromDef, getQualifiedPropertyFromDef, getScopeNode, getUsedNamespaces, hasAnyBindableDefinitions, isInWith, reconnectScopeNode, setAsContainingScopeOfAnonymousFunction, setContainingDefinition, setContainingScope
addDefinition, addDefinitionToStore, getAllLocalDefinitions, getAllLocalDefinitionSets, getAllLocalNames, getAllLocalProperties, getLocalDefinitionSetByName, getLocalProperty, getLocalProperty, getLocalProperty, isContingentDefinitionNeeded, removeDefinition, removeDefinitionFromStore, toString, verify
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAllLocalDefinitions, getAllLocalDefinitionSets, getAllLocalNames, getContainingScope, getDefinition, getLocalDefinitionSetByName, getScopeNode
protected String filePath
protected Boolean isEditableFile
protected WeakReference<ICompilationUnit> compilationUnitReference
public ASFileScope(IFileSpecificationGetter fileSpecGetter, String filePath)
fileSpecGetter
- IFileSpecificationGetter
that is used to
open files associated with this ASFileScope
.filePath
- Normalized absolute name of the file for which this
ASFileScope
is being created.public ASFileScope(FileNode fileNode)
fileNode
- file node whose scope this representspublic static Collection<String> getImplicitImportsForAS()
For AS3, there is a single implicit import, "__AS3__.vec.Vector"
.
protected boolean isEditableFile()
protected String toStringHeader()
toStringHeader
in class ASScope
public boolean isPackageName(String p)
isPackageName
in class ASScope
p
- the string to testprotected boolean namespaceSetSameAsContainingScopeNamespaceSet()
namespaceSetSameAsContainingScopeNamespaceSet
in class ASScope
public INamespaceDefinition.ILanguageNamespaceDefinition getFilePrivateNamespaceReference()
public IWorkspace getWorkspace()
ASScope
IWorkspace
in which this ASScope
lives.getWorkspace
in class ASScope
IWorkspace
in which this ASScope
lives.public String getContainingSourcePath(String qName, ICompilerProject project)
If this ASFileScope
comes from an ActionScript file, return the
ActionScript file path. File scopes coming from ABC or SWC files will
override this method to locate their source file path.
getContainingSourcePath
in class ASScope
qName
- QName of a definitionproject
- resolve the source path within this projectASFileScope
.public String getContainingPath()
getContainingPath
in interface IFileScope
public void collectExternallyVisibleDefinitions(Collection<IDefinition> defs, boolean includePrivateDefinitions)
IFileScope
The externally-visible definitions are the ones in a file scope or in a package scope.
collectExternallyVisibleDefinitions
in interface IFileScope
defs
- The collection of IDefinition
's to which the
externally-visible definitions in this scope are to be added.includePrivateDefinitions
- If true, definitions with private
namespace qualifiers are added to the specified collection.public void addImplicitOpenNamespaces(CompilerProject compilerProject, Set<INamespaceDefinition> result)
addImplicitOpenNamespaces
in class ASScope
public IASNode reparseFile() throws InterruptedException
IASNode
of the syntax tree.InterruptedException
public void setOffsetLookup(OffsetLookup offsetLookup)
OffsetLookup
utility.offsetLookup
- offset lookup utilitypublic OffsetLookup getOffsetLookup()
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 boolean isSWC()
isSWC
in interface IFileScope
public IASNode getNode()
public boolean setCompilationUnit(ICompilationUnit compilationUnit)
ICompilationUnit
related to this ASFileScope
.
This class is overridden by SWCFileScope which will never set the
project reference, as SWC scopes are shared across projects.compilationUnit
- A compilation unit.ICompilationUnit
was stored, false if not
stored. This happens when trying to store a SWCCompilationUnit.public ICompilationUnit getCompilationUnit()
ICompilationUnit
related to this ASFileScope
.
SWCFileScope will override this class.
Note that this class should only ever be called from ASProjectScope or CompilerProject.
Clients should only ever use ASProjectScope.getCompilationUnitForScope()ICompilationUnit
. May be null when a SWCFileScopeProvider.SWCFileScope
public void addParsedFunctionBodies(FunctionNode functionNode)
functionNode
- the FunctionNode to addpublic void removeParsedFunctionBodies(FunctionNode functionNode)
functionNode
- the FunctionNode to addpublic void addDependencyOnBuiltinType(ICompilerProject project, IASLanguageConstants.BuiltinType builtinType, DependencyType dependencyType)
ASScope
addDependencyOnBuiltinType
in class ASScope
project
- the active projectbuiltinType
- the builtin type to depend ondependencyType
- the type of dependency to addCopyright © 2016 The Apache Software Foundation. All rights reserved.