public class Es6SyntacticScopeCreator
extends java.lang.Object
The syntactic scope creator scans the parse tree to create a Scope object containing all the variable declarations in that scope. This class adds support for block-level scopes introduced in ECMAScript 6.
This implementation is not thread-safe.
Modifier and Type | Class and Description |
---|---|
static interface |
Es6SyntacticScopeCreator.ScopeFactory
A simple API for injecting the use of alternative Scope classes
|
Modifier and Type | Field and Description |
---|---|
static com.google.javascript.jscomp.ScopeCreator |
ASSERT_NO_SCOPES_CREATED
A scope creator that can be provided to NodeTraversal to ensure that no scopes are actually
ever created.
|
static com.google.javascript.jscomp.Es6SyntacticScopeCreator.RedeclarationHandler |
DEFAULT_REDECLARATION_HANDLER |
Constructor and Description |
---|
Es6SyntacticScopeCreator(AbstractCompiler compiler) |
Es6SyntacticScopeCreator(AbstractCompiler compiler,
Es6SyntacticScopeCreator.ScopeFactory scopeFactory) |
Modifier and Type | Method and Description |
---|---|
Scope |
createScope(Node n,
com.google.javascript.jscomp.AbstractScope<?,?> parent)
Creates a
Scope object. |
boolean |
hasBlockScope() |
public static final com.google.javascript.jscomp.Es6SyntacticScopeCreator.RedeclarationHandler DEFAULT_REDECLARATION_HANDLER
public static final com.google.javascript.jscomp.ScopeCreator ASSERT_NO_SCOPES_CREATED
public Es6SyntacticScopeCreator(AbstractCompiler compiler)
public Es6SyntacticScopeCreator(AbstractCompiler compiler, Es6SyntacticScopeCreator.ScopeFactory scopeFactory)
public boolean hasBlockScope()
public Scope createScope(Node n, com.google.javascript.jscomp.AbstractScope<?,?> parent)
Scope
object.n
- 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)Copyright © 2009-2019 Google. All Rights Reserved.