@Override public Scope create(Scope parent, Node n) { return (parent == null) ? Scope.createGlobalScope(n) : Scope.createChildScope(parent, n); } }
@Override public Scope createScope(Node n, Scope parent) { inputId = null; if (parent == null) { scope = Scope.createGlobalScope(n); } else { scope = new Scope(parent, n); } scanRoot(n); inputId = null; Scope returnedScope = scope; scope = null; return returnedScope; }
DecomposeYields(AbstractCompiler compiler) { this.compiler = compiler; Set<String> consts = new HashSet<String>(); decomposer = new ExpressionDecomposer( compiler, compiler.getUniqueNameIdSupplier(), consts, Scope.createGlobalScope(new Node(Token.SCRIPT))); }
YieldExposer() { decomposer = new ExpressionDecomposer( compiler, compiler.getUniqueNameIdSupplier(), new HashSet<>(), Scope.createGlobalScope(new Node(Token.SCRIPT)), compiler.getOptions().allowMethodCallDecomposing()); }
@Override public void hotSwapScript(Node scriptRoot, Node originalRoot) { GlobalVarReferenceMap refMap = compiler.getGlobalVarReferences(); if (refMap != null) { // We don't have a suitable untyped scope to use, but the actual scope probably doesn't // matter, so long as it's a global scope and doesn't persist references to things that // need to be cleaned up. So we just generate a new simple root scope. refMap.updateReferencesWithGlobalScope( Scope.createGlobalScope(compiler.getTopScope().getRootNode())); } }
Es6ExtractClasses(AbstractCompiler compiler) { this.compiler = compiler; Set<String> consts = new HashSet<>(); this.expressionDecomposer = new ExpressionDecomposer( compiler, compiler.getUniqueNameIdSupplier(), consts, Scope.createGlobalScope(new Node(Token.SCRIPT)), compiler.getOptions().allowMethodCallDecomposing()); }
@Override @SuppressWarnings("unchecked") // The cast to T is OK because we cannot mix typed and untyped scopes in the same chain. public <T extends Scope> T createScope(Node n, T parent) { inputId = null; if (parent == null) { scope = isTyped ? TypedScope.createGlobalScope(n) : Scope.createGlobalScope(n); } else { scope = isTyped ? new TypedScope((TypedScope) parent, n) : new Scope(parent, n); } scanRoot(n); inputId = null; Scope returnedScope = scope; scope = null; return (T) returnedScope; }
@Override @SuppressWarnings("unchecked") // The cast to T is OK because we cannot mix typed and untyped scopes in the same chain. public AbstractScope<?, ?> createScope(Node n, AbstractScope<?, ?> parent) { inputId = null; if (parent == null) { scope = isTyped ? TypedScope.createGlobalScope(n) : Scope.createGlobalScope(n); } else { scope = isTyped ? new TypedScope((TypedScope) parent, n) : Scope.createChildScope((Scope) parent, n); } scanRoot(n); inputId = null; AbstractScope<?, ?> returnedScope = scope; scope = null; return returnedScope; }
.createScope(scriptRoot.getFirstChild(), Scope.createGlobalScope(scriptRoot)); Var googVar = moduleScope.getVar("goog");