Lines Matching refs:scope
66 Variable* Declare(Zone* zone, Scope* scope, const AstRawString* name,
89 // and ModuleScope. DeclarationScope is used for any scope that hosts 'var'
91 // scope. ModuleScope further specializes DeclarationScope.
100 // The scope name is only used for printing/debugging.
115 inline explicit Snapshot(Scope* scope);
122 // Restore eval flags from before the scope was active.
139 // While the scope is active, the scope caches the flag values for
143 // scope. Otherwise the cached flags will be merged with the flags from the
164 // Checks if the block scope is redundant, i.e. it does not contain any
165 // block scoped declarations. In that case it is removed from the scope
169 // Inserts outer_scope into this scope's scope chain (and removes this
170 // from the current outer_scope_'s inner scope list).
193 // Lookup a variable in this scope. Returns the variable or nullptr if not
202 // Declare a local variable in this scope. If the variable has been
258 // Creates a new temporary variable in this scope's TemporaryScope. The
267 // |scope|. This is used to catch patterns like `try{}catch(e){let e;}` and
271 const AstRawString* FindVariableDeclaredIn(Scope* scope,
277 // Inform the scope and outer scopes that the corresponding code contains an
283 for (Scope* scope = outer_scope(); scope != nullptr;
284 scope = scope->outer_scope()) {
285 if (scope->inner_scope_calls_eval_) return;
286 scope->inner_scope_calls_eval_ = true;
296 // Inform the scope that the scope may execute declarations nonlinearly.
297 // Currently, the only nonlinear scope is a switch statement. The name is
300 // its own lexical scope.
307 // Position in the source where this scope begins and ends.
309 // * For the scope of a with statement
313 // * For the scope of a block
317 // * For the scope of a function literal or decalaration
321 // * For the scope of a catch block
325 // * For the scope of a for-statement
329 // * For the scope of a switch statement
355 // Specific scope types.
387 // Returns true if this scope or any inner scopes that might be eagerly
392 // Does this scope have the potential to execute declarations non-linearly?
394 // Returns if we need to force a context because the current scope is stricter
449 // Check is this scope is an outer scope of the given scope.
455 // The type of this scope.
458 // The language mode of this scope.
463 // inner_scope() and sibling() together implement the inner scope list of a
464 // scope. Inner scope points to the an inner scope of the function, and
465 // "sibling" points to a next inner scope of the outer scope of this scope.
469 // The scope immediately surrounding this scope, or nullptr.
509 // Determine if we can parse a function literal in this scope lazily without
513 // The number of contexts between this and scope; zero if this == scope.
514 int ContextChainLength(Scope* scope) const;
520 // Find the first function, script, eval or (declaration) block scope. This is
521 // the scope where var declarations will be hoisted to in the implementation.
524 // Find the first function, script, or (declaration) block scope.
525 // This is the scope where var declarations will be hoisted to in the
532 // Find the first non-block declaration scope. This should be either a script,
533 // function, or eval scope. Same as DeclarationScope(), but skips declaration
535 // the scope for which a function prologue allocates a context) or declaring
540 // Find the first (non-arrow) function or script scope. This is where
544 // Find the first constructor scope. Its outer scope is where the instance
549 // Find the first class scope or object literal block scope. This is where
555 // Find the innermost outer scope that needs a context.
574 // Check that the scope has positions assigned.
577 // Check that all Scopes in the scope tree use the same Zone.
618 for (Scope* scope = inner_scope_; scope != nullptr;
619 scope = scope->sibling_) {
620 if (scope->sibling_ == inner_scope) {
621 scope->sibling_ = scope->sibling_->sibling_;
635 for (Scope* scope = this; scope != nullptr; scope = scope->outer_scope()) {
636 Variable* var = scope->LookupInScopeOrScopeInfo(name, scope);
670 // Walk the scope chain to find DeclarationScopes; call
684 // Lookup a variable reference given by name starting with this scope, and
685 // stopping when reaching the outer_scope_end scope. If the code is executed
689 static Variable* Lookup(VariableProxy* proxy, Scope* scope,
692 static Variable* LookupWith(VariableProxy* proxy, Scope* scope,
695 static Variable* LookupSloppyEval(VariableProxy* proxy, Scope* scope,
698 static void ResolvePreparsedVariable(VariableProxy* proxy, Scope* scope,
704 // Finds free variables of this scope. This mutates the unresolved variables
732 // Construct a scope based on the scope info.
736 // Construct a catch scope with a binding for the name.
754 Scope* outer_scope_; // the immediately enclosing outer scope, or nullptr
755 Scope* inner_scope_; // an inner scope of this scope
756 Scope* sibling_; // a sibling inner scope of the outer scope of this scope.
758 // The variables declared in this scope:
762 // an inner scope) with no intervening with statements or eval calls.
767 // Unresolved variables referred to from this scope. The proxies themselves
773 // Serialized scope info support.
779 // True if it doesn't need scope resolution (e.g., if the scope was
780 // constructed based on a serialized scope info or a catch context).
782 // True if this scope may contain objects from a temp zone that needs to be
795 // The scope type.
800 // The language mode of this scope.
803 // This scope contains an 'eval' call.
805 // The context associated with this scope can be extended by a sloppy eval
808 // This scope's declarations might not be executed in order (e.g., switch).
815 // True if one of the inner scopes or the scope itself calls eval.
822 // True if the outer scope is a class scope and should be skipped when
823 // resolving private names, i.e. if the scope is in a class heritage
829 // True if this is a script scope that originated from
833 // True if this is a deserialized scope which caches its lookups on another
834 // Scope's variable map. This will be true for every scope above the first
835 // non-eval declaration scope above the compilation entry point, e.g. for
848 // the compilation of the eval will have the "with" scope as the first scope
863 // Creates a script scope.
869 // Inform the scope that the corresponding code uses "super".
887 // Inform the scope and outer scopes that the corresponding code contains an
899 // Sloppy eval in a eval scope can only introduce variables into the outer
900 // (non-eval) declaration scope, not into this eval scope.
904 // 1. The outer non-eval declaration scope should already be marked as
907 // 2. The outer non-eval declaration scope is a script scope and thus
962 // Check if the scope has conflicting var
964 // scope over a let binding of the same name.
1004 // is in an intermediate scope between this function scope and the the
1005 // outer scope. Only possible for function scopes; at most one variable.
1008 // declared in the scope. It will add a variable for {name} to {variables_};
1018 // Declare a parameter in this scope. When there are duplicated
1028 // Declare an implicit global variable in this scope which must be a
1029 // script scope. The variable was introduced (possibly from an inner
1030 // scope) by a reference to an unresolved variable with no intervening
1082 // communicate that the scope is non-simple, without allocating any parameters
1128 // Adds a local variable in this scope's locals list. This is for adjusting
1129 // the scope of temporaries and do-expression vars when desugaring parameter
1136 // Go through sloppy_block_functions_ and hoist those (into this scope)
1140 // Compute top scope and allocate variables. For lazy compilation the top
1141 // scope only contains the single lazily compiled function, so this
1150 // To be called during parsing. Do just enough scope analysis that we can
1158 // Allocate ScopeInfos for top scope and any inner scopes that need them.
1167 // Determine if we can use lazy compilation for this scope.
1204 // Save data describing the context allocation of the variables in this scope
1258 // preparation for AllocateScopeInfos. Because the private name scope is
1265 // This scope contains an "use asm" annotation.
1269 // This function scope has a rest parameter.
1271 // This scope has a parameter called "arguments".
1273 // This scope uses "super" property ('super.foo').
1276 // Set to true after we have finished lazy parsing the scope.
1288 // If the scope is a function scope, this is the function kind.
1306 // For producing the scope allocation data during preparsing.
1365 Scope::Snapshot::Snapshot(Scope* scope)
1366 : outer_scope_(scope),
1367 declaration_scope_(scope->GetDeclarationScope()),
1368 top_inner_scope_(scope->inner_scope_),
1369 top_unresolved_(scope->unresolved_list_.end()),
1370 top_local_(scope->GetClosureScope()->locals_.end()),
1387 // Returns nullptr in a deserialized scope.
1418 // local variables of this scope.
1422 // Try resolving all unresolved private names found in the current scope.
1431 // - If we find the private name in the scope chain, return nullptr.
1432 // If the name is found in the current class scope, resolve it
1467 // Only maintained when the scope is parsed, not when the scope is
1473 // Returns whether the index of class variable of this class scope should be
1475 // If any inner scope accesses static private names directly, the class
1477 // The inner scope may also calls eval which may results in access to
1479 // Only maintained when the scope is parsed.
1486 // Only maintained when the scope is parsed.
1494 // Finalize the reparsed class scope, called when reparsing the
1495 // class scope for the initializer member function.
1496 // If the reparsed scope declares any variable that needs allocation
1497 // fixup using the scope info, needs_allocation_fixup is true.
1511 // if it cannot be found there, try scope info if there is any.
1515 // scope.
1517 // Lookup a private name from the scope info of the current scope.
1544 // These are only maintained when the scope is parsed, not when the
1545 // scope is deserialized.
1557 // Iterate over the private name scope chain. The iteration proceeds from the
1558 // innermost private name scope outwards.
1566 // Add an unresolved private name to the current scope.