final class TypedScopeCreator extends java.lang.Object implements ScopeCreator
Modifier and Type | Class and Description |
---|---|
private class |
TypedScopeCreator.AbstractScopeBuilder |
private class |
TypedScopeCreator.DeferredSetType
Defer attachment of types to nodes until all type names
have been resolved.
|
private static class |
TypedScopeCreator.DiscoverEnumsAndTypedefs |
private static class |
TypedScopeCreator.FirstOrderFunctionAnalyzer
Does a first-order function analysis that just looks at simple things
like what variables are escaped, and whether 'this' is used.
|
private class |
TypedScopeCreator.GlobalScopeBuilder
A shallow traversal of the global scope to build up all classes,
functions, and methods.
|
private class |
TypedScopeCreator.LocalScopeBuilder
A shallow traversal of a local scope to find all arguments and
local variables.
|
private static class |
TypedScopeCreator.StubDeclaration
A stub declaration without any type information.
|
Constructor and Description |
---|
TypedScopeCreator(AbstractCompiler compiler) |
TypedScopeCreator(AbstractCompiler compiler,
CodingConvention codingConvention) |
Modifier and Type | Method and Description |
---|---|
(package private) TypedScope |
createInitialScope(Node root)
Create the outermost scope.
|
TypedScope |
createScope(Node root,
Scope parent)
Creates a scope with all types declared.
|
private void |
declareNativeFunctionType(TypedScope scope,
JSTypeNative tId) |
private static void |
declareNativeType(TypedScope scope,
java.lang.String name,
JSType t) |
private void |
declareNativeValueType(TypedScope scope,
java.lang.String name,
JSTypeNative tId) |
private FunctionTypeBuilder.AstFunctionContents |
getFunctionAnalysisResults(Node n) |
private JSType |
getNativeType(JSTypeNative nativeType) |
boolean |
hasBlockScope() |
(package private) void |
patchGlobalScope(TypedScope globalScope,
Node scriptRoot)
Patches a given global scope by removing variables previously declared in
a script and re-traversing a new version of that script.
|
private void |
report(JSError error) |
static final java.lang.String DELEGATE_PROXY_SUFFIX
static final DiagnosticType MALFORMED_TYPEDEF
static final DiagnosticType ENUM_INITIALIZER
static final DiagnosticType CTOR_INITIALIZER
static final DiagnosticType IFACE_INITIALIZER
static final DiagnosticType CONSTRUCTOR_EXPECTED
static final DiagnosticType UNKNOWN_LENDS
static final DiagnosticType LENDS_ON_NON_OBJECT
static final DiagnosticGroup ALL_DIAGNOSTICS
private final AbstractCompiler compiler
private final ErrorReporter typeParsingErrorReporter
private final TypeValidator validator
private final CodingConvention codingConvention
private final JSTypeRegistry typeRegistry
private final java.util.List<ObjectType> delegateProxyPrototypes
private final java.util.Map<java.lang.String,java.lang.String> delegateCallingConventions
private final boolean runsAfterNTI
private final java.util.Map<Node,FunctionTypeBuilder.AstFunctionContents> functionAnalysisResults
private final ObjectType unknownType
TypedScopeCreator(AbstractCompiler compiler)
TypedScopeCreator(AbstractCompiler compiler, CodingConvention codingConvention)
private void report(JSError error)
public TypedScope createScope(Node root, Scope parent)
createScope
in interface ScopeCreator
root
- the root node (either a FUNCTION node, a SCRIPT node, or a
synthetic block node whose children are all SCRIPT nodes)parent
- the parent Scope object (may be null)void patchGlobalScope(TypedScope globalScope, Node scriptRoot)
globalScope
- The global scope generated by createScope
.scriptRoot
- The script that is modified.TypedScope createInitialScope(Node root)
Object
, Date
, etc.private void declareNativeFunctionType(TypedScope scope, JSTypeNative tId)
private void declareNativeValueType(TypedScope scope, java.lang.String name, JSTypeNative tId)
private static void declareNativeType(TypedScope scope, java.lang.String name, JSType t)
private JSType getNativeType(JSTypeNative nativeType)
private FunctionTypeBuilder.AstFunctionContents getFunctionAnalysisResults(@Nullable Node n)
public boolean hasBlockScope()
hasBlockScope
in interface ScopeCreator