Package | Description |
---|---|
com.google.javascript.jscomp |
Provides the core compiler and its public API.
|
Modifier and Type | Class and Description |
---|---|
class |
TypedScope
TypedScope contains information about variables and their types.
|
Modifier and Type | Field and Description |
---|---|
private Scope |
GlobalNamespace.externsScope |
private Scope |
MustBeReachingVariableDef.jsScope |
private Scope |
LiveVariablesAnalysis.jsScope |
private Scope |
MaybeReachingVariableUse.jsScope |
Scope |
ClosureRewriteModule.ModuleDescription.moduleScope |
private Scope |
ReferenceCollectingCallback.narrowScope |
private Scope |
Scope.parent |
private Scope |
SyntacticScopeCreator.scope |
private Scope |
ReferenceCollectingCallback.Reference.scope |
(package private) Scope |
Var.scope
The enclosing scope
|
(package private) Scope |
AnalyzePrototypeProperties.NameContext.scope |
private Scope |
ExpressionDecomposer.scope |
private Scope |
Es6SyntacticScopeCreator.scope |
private Scope |
RemoveUnusedVars.Continuation.scope |
(package private) Scope |
FunctionInjector.Reference.scope |
(package private) Scope |
UseSite.scope |
(package private) Scope |
GlobalNamespace.AstChange.scope |
(package private) Scope |
GlobalNamespace.Ref.scope |
private Scope |
ExpandJqueryAliases.FindCallbackArgumentReferences.startingScope |
Modifier and Type | Field and Description |
---|---|
private java.util.List<Scope> |
RemoveUnusedVars.allFunctionScopes
Keep track of scopes that we've traversed.
|
private com.google.common.collect.ArrayListMultimap<Scope,Var> |
RenameVars.localBleedingFunctionsPerScope |
private java.util.Deque<Scope> |
NodeTraversal.scopes
Stack containing the Scopes that have been created.
|
Modifier and Type | Method and Description |
---|---|
<T extends Scope> |
SyntacticScopeCreator.createScope(Node n,
T parent) |
<T extends Scope> |
ScopeCreator.createScope(Node n,
T parent)
Creates a
Scope object. |
Modifier and Type | Method and Description |
---|---|
(package private) static Scope |
Scope.createGlobalScope(Node rootNode) |
Scope |
Es6SyntacticScopeCreator.createScope(Node n,
Scope parent) |
Scope |
Scope.getClosestHoistScope()
If a var were declared in this scope, return the scope it would be hoisted to.
|
Scope |
NodeTraversal.getClosestHoistScope() |
Scope |
TypedScope.getClosestHoistScope() |
(package private) Scope |
Scope.getGlobalScope() |
Scope |
Scope.getParent() |
(package private) Scope |
ReferenceCollectingCallback.Reference.getScope() |
Scope |
Var.getScope() |
Scope |
NodeTraversal.getScope()
Gets the current scope.
|
Scope |
ReferenceCollectingCallback.getScope(Var var) |
Modifier and Type | Method and Description |
---|---|
private void |
InlineObjectLiterals.InliningBehavior.blacklistVarReferencesInTree(Node root,
Scope scope)
If there are any variable references in the given node tree,
blacklist them to prevent the pass from trying to inline the
variable.
|
private void |
InlineVariables.InliningBehavior.blacklistVarReferencesInTree(Node root,
Scope scope)
If there are any variable references in the given node tree, blacklist
them to prevent the pass from trying to inline the variable.
|
private boolean |
OptimizeParameters.buildParameterList(java.util.List<OptimizeParameters.Parameter> parameters,
Node cur,
Scope s) |
private boolean |
CollapseVariableDeclarations.GatherCollapses.canBeRedeclared(Node n,
Scope s) |
(package private) static boolean |
NodeUtil.canBeSideEffected(Node n,
java.util.Set<java.lang.String> knownConstants,
Scope scope) |
private boolean |
FlowSensitiveInlineVariables.Candidate.canInline(Scope scope) |
private static boolean |
CrossModuleCodeMotion.canMoveValue(ReferenceCollectingCallback collector,
Scope scope,
Node n)
Determines whether the given value is eligible to be moved across modules.
|
private void |
VariableReferenceCheck.ReferenceCheckingBehavior.checkDefaultParam(Var param,
Scope scope,
java.util.Set<java.lang.String> varsInFunctionBody) |
private void |
VariableReferenceCheck.ReferenceCheckingBehavior.checkShadowParam(Var v,
Scope functionScope,
java.util.List<ReferenceCollectingCallback.Reference> references) |
(package private) ReferenceCollectingCallback.Reference |
ReferenceCollectingCallback.Reference.cloneWithNewScope(Scope newScope)
Makes a copy of the current reference using a new Scope instance.
|
void |
GlobalNamespace.BuildGlobalNamespace.collect(JSModule module,
Scope scope,
Node n) |
private void |
RemoveUnusedVars.collectMaybeUnreferencedVars(Scope scope)
For each variable in this scope that we haven't found a reference
for yet, add it to the list of variables to check later.
|
(package private) static void |
DataFlowAnalysis.computeEscaped(Scope jsScope,
java.util.Set<Var> escaped,
AbstractCompiler compiler)
Compute set of escaped variables.
|
private NameAnalyzer.NameInformation |
NameAnalyzer.createNameInformation(java.lang.String name,
Scope scope,
Node rootNameNode)
Creates name information for a particular qualified name that occurs in a
particular scope.
|
TypedScope |
TypedScopeCreator.createScope(Node root,
Scope parent)
Creates a scope with all types declared.
|
TypedScope |
MemoizedScopeCreator.createScope(Node n,
Scope parent) |
Scope |
Es6SyntacticScopeCreator.createScope(Node n,
Scope parent) |
private void |
Es6SyntacticScopeCreator.declareLHS(Scope declarationScope,
Node lhs) |
private void |
Es6SyntacticScopeCreator.declareVar(Scope s,
Node n)
Declares a variable.
|
(package private) GlobalNamespace.Ref.Type |
GlobalNamespace.BuildGlobalNamespace.determineGetTypeForHookOrBooleanExpr(JSModule module,
Scope scope,
Node parent,
java.lang.String name)
Determines whether the result of a hook (x?y:z) or boolean expression
(x||y) or (x&&y) is assigned to a specific global name.
|
private void |
ScopedAliases.Traversal.findAliases(NodeTraversal t,
Scope scope) |
private RenameVars.Assignment |
ShadowVariables.DoShadowVariables.findBestShadow(Scope curScope) |
private void |
RewritePolyfills.Traverser.fixJsdoc(Scope scope,
JSDocInfo doc) |
private void |
RewritePolyfills.Traverser.fixJsdocType(Scope scope,
Node node) |
private ExpressionDecomposer |
FunctionInjector.getDecomposer(Scope scope) |
(package private) void |
GlobalNamespace.BuildGlobalNamespace.handleGet(JSModule module,
Scope scope,
Node n,
Node parent,
java.lang.String name)
Updates our representation of the global namespace to reflect a read
of a global name.
|
(package private) void |
GlobalNamespace.BuildGlobalNamespace.handleGet(JSModule module,
Scope scope,
Node n,
Node parent,
java.lang.String name,
GlobalNamespace.Ref.Type type)
Updates our representation of the global namespace to reflect a read
of a global name.
|
(package private) void |
GlobalNamespace.BuildGlobalNamespace.handleSetFromGlobal(JSModule module,
Scope scope,
Node n,
Node parent,
java.lang.String name,
boolean isPropAssign,
GlobalNamespace.Name.Type type)
Updates our representation of the global namespace to reflect an
assignment to a global name in global scope.
|
(package private) void |
GlobalNamespace.BuildGlobalNamespace.handleSetFromLocal(JSModule module,
Scope scope,
Node n,
Node parent,
java.lang.String name)
Updates our representation of the global namespace to reflect an
assignment to a global name in a local scope.
|
(package private) static boolean |
NodeUtil.isConstantVar(Node node,
Scope scope) |
private boolean |
NameAnalyzer.isExternallyReferenceable(Scope scope,
java.lang.String name)
Checks whether a name can be referenced outside of the compiled code.
|
private boolean |
GlobalNamespace.isGlobalNameReference(java.lang.String name,
Scope s)
Determines whether a name reference in a particular scope is a global name
reference.
|
private boolean |
GlobalNamespace.isGlobalVarReference(java.lang.String name,
Scope s)
Determines whether a variable name reference in a particular scope is a
global variable reference.
|
private static boolean |
OptimizeParameters.isMovableValue(Node n,
Scope s) |
private boolean |
ExpandJqueryAliases.FindCallbackArgumentReferences.isShadowed(java.lang.String name,
Scope scope) |
private boolean |
NameReferenceGraphConstruction.Traversal.isStaticNameReference(Node n,
Scope scope) |
(package private) static Var |
Var.makeArgumentsVar(Scope scope) |
private boolean |
RemoveUnusedVars.CallSiteOptimizer.markUnreferencedFunctionArgs(Scope scope,
Node function,
java.util.Set<Var> referenced,
Node param,
int paramIndex,
boolean canChangeSignature)
For each unused function parameter, determine if it can be removed
from all the call sites, if so, remove it from the function signature
and the call sites otherwise replace the unused value where possible
with a constant (0).
|
private boolean |
InlineVariables.InliningBehavior.maybeEscapedOrModifiedArguments(Scope scope,
ReferenceCollectingCallback.ReferenceMap referenceMap) |
(package private) boolean |
GlobalNamespace.BuildGlobalNamespace.maybeHandlePrototypePrefix(JSModule module,
Scope scope,
Node n,
Node parent,
java.lang.String name)
Updates our representation of the global namespace to reflect a read
of a global name's longest prefix before the "prototype" property if the
name includes the "prototype" property.
|
void |
SyntacticScopeCreator.RedeclarationHandler.onRedeclaration(Scope s,
java.lang.String name,
Node n,
CompilerInput input) |
void |
SyntacticScopeCreator.DefaultRedeclarationHandler.onRedeclaration(Scope s,
java.lang.String name,
Node n,
CompilerInput input) |
void |
VarCheck.RedeclarationCheckHandler.onRedeclaration(Scope s,
java.lang.String name,
Node n,
CompilerInput input) |
void |
Normalize.DuplicateDeclarationHandler.onRedeclaration(Scope s,
java.lang.String name,
Node n,
CompilerInput input)
Remove duplicate VAR declarations encountered discovered during
scope creation.
|
void |
RemoveUnusedVars.CallSiteOptimizer.optimize(Scope fnScope,
java.util.Set<Var> referenced) |
(package private) void |
ReferenceCollectingCallback.processScope(Scope scope)
Targets reference collection to a particular scope.
|
private void |
NodeTraversal.pushScope(Scope s)
Creates a new scope (e.g.
|
private void |
NodeTraversal.pushScope(Scope s,
boolean quietly)
Creates a new scope (e.g.
|
private static void |
FunctionInjector.removeConstantVarAnnotation(Scope scope,
java.lang.String name) |
private void |
RemoveUnusedVars.removeUnreferencedFunctionArgs(Scope fnScope)
Removes unreferenced arguments from a function declaration and when
possible the function's callSites.
|
private void |
GlobalNamespace.scanFromNode(GlobalNamespace.BuildGlobalNamespace builder,
JSModule module,
Scope scope,
Node n) |
private static boolean |
CoalesceVariableNames.shouldOptimizeScope(Scope scope) |
private boolean |
RenameVars.shouldTemporarilyRenameLocalsInScope(Scope s)
Returns true if the local variables in a scope should be given
temporary names (eg, 'L 123') prior to renaming to allow reuse of
names across scopes.
|
(package private) void |
NodeTraversal.traverseAtScope(Scope s)
Traverses a parse tree recursively with a scope, starting at that scope's
root.
|
private void |
RemoveUnusedVars.traverseFunction(Node n,
Scope parentScope)
Traverses a function, which creates a new scope in JavaScript.
|
void |
NodeTraversal.traverseFunctionOutOfBand(Node node,
Scope scope)
Traverse a function out-of-band of normal traversal.
|
(package private) void |
NodeTraversal.traverseInnerNode(Node node,
Node parent,
Scope refinedScope)
Traverses an inner node recursively with a refined scope.
|
private void |
RemoveUnusedVars.traverseNode(Node n,
Node parent,
Scope scope)
Traverses everything in the current scope and marks variables that
are referenced.
|
(package private) void |
NodeTraversal.traverseWithScope(Node root,
Scope s)
Traverses a parse tree recursively with a scope, starting with the given
root.
|
private boolean |
OptimizeArgumentsArray.tryReplaceArguments(Scope scope)
Tries to optimize all the arguments array access in this scope by assigning
a name to each element.
|
void |
GlobalVarReferenceMap.updateReferencesWithGlobalScope(Scope globalScope) |
private void |
ClosureRewriteModule.updateRootShadows(Scope s,
com.google.common.collect.ImmutableSet<java.lang.String> roots) |
private boolean |
PureFunctionIdentifier.FunctionAnalyzer.varDeclaredInDifferentFunction(Var v,
Scope scope) |
private void |
PureFunctionIdentifier.FunctionAnalyzer.visitAssignmentOrUnaryOperator(PureFunctionIdentifier.FunctionInformation sideEffectInfo,
Scope scope,
Node op,
Node lhs,
Node rhs)
Record information about the side effects caused by an
assignment or mutating unary operator.
|
Constructor and Description |
---|
Arguments(Scope scope) |
AstChange(JSModule module,
Scope scope,
Node node) |
Continuation(Node node,
Scope scope) |
ExpressionDecomposer(AbstractCompiler compiler,
com.google.common.base.Supplier<java.lang.String> safeNameIdSupplier,
java.util.Set<java.lang.String> constNames,
Scope scope) |
LiveVariablesAnalysis(ControlFlowGraph<Node> cfg,
Scope jsScope,
AbstractCompiler compiler) |
MaybeReachingVariableUse(ControlFlowGraph<Node> cfg,
Scope jsScope,
AbstractCompiler compiler) |
MustBeReachingVariableDef(ControlFlowGraph<Node> cfg,
Scope jsScope,
AbstractCompiler compiler) |
NameContext(AnalyzePrototypeProperties.NameInfo name,
Scope scope) |
Ref(JSModule module,
Scope scope,
Node node,
GlobalNamespace.Name name,
GlobalNamespace.Ref.Type type,
int index)
Creates a reference at the current node.
|
Reference(Node nameNode,
ReferenceCollectingCallback.BasicBlock basicBlock,
Scope scope,
InputId inputId) |
Reference(Node callNode,
Scope scope,
JSModule module,
FunctionInjector.InliningMode mode) |
Reference(Node callNode,
Scope scope,
JSModule module,
FunctionInjector.InliningMode mode) |
Scope(Scope parent,
Node rootNode)
Creates a Scope given the parent Scope and the root node of the scope.
|
UseSite(Node node,
Scope scope,
JSModule module) |
Var(java.lang.String name,
Node nameNode,
Scope scope,
int index,
CompilerInput input) |