Home | History | Annotate | Download | only in ast

Lines Matching defs:scope

34       Zone* zone, Scope* scope, const AstRawString* name, VariableMode mode,
56 explicit Delegate(Scope* scope,
58 : scope_(scope), statement_(statement), next_(nullptr) {}
62 Scope* scope() const { return scope_; }
65 Scope* scope_;
85 // JS environments are represented in the parser using Scope, DeclarationScope
86 // and ModuleScope. DeclarationScope is used for any scope that hosts 'var'
88 // scope. ModuleScope further specializes DeclarationScope.
89 class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
94 Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type);
97 // The scope name is only used for printing/debugging.
104 // TODO(verwaest): Is this needed on Scope?
114 explicit Snapshot(Scope* scope);
119 Scope* outer_scope_;
120 Scope* top_inner_scope_;
128 static Scope* DeserializeScopeChain(Isolate* isolate, Zone* zone,
134 // Checks if the block scope is redundant, i.e. it does not contain any
135 // block scoped declarations. In that case it is removed from the scope
137 Scope* FinalizeBlockScope();
141 // Find the first scope that hasn't been removed.
142 Scope* GetUnremovedScope();
144 // Inserts outer_scope into this scope's scope chain (and removes this
145 // from the current outer_scope_'s inner scope list).
147 void ReplaceOuterScope(Scope* outer_scope);
149 // Propagates any eagerly-gathered scope usage flags (such as calls_eval())
150 // to the passed-in scope.
151 void PropagateUsageFlagsToScope(Scope* other);
158 // Lookup a variable in this scope. Returns the variable or NULL if not found.
167 // Lookup a variable in this scope or outer scopes.
171 // Declare a local variable in this scope. If the variable has been
208 // Creates a new temporary variable in this scope's TemporaryScope. The
219 // Check if the scope has conflicting var
221 // scope over a let binding of the same name.
224 // Check if the scope has a conflicting lexical declaration that has a name in
233 // Scope-specific info.
235 // Inform the scope and outer scopes that the corresponding code contains an
240 for (Scope* scope = outer_scope(); scope != nullptr;
241 scope = scope->outer_scope()) {
242 scope->inner_scope_calls_eval_ = true;
252 // Inform the scope that the scope may execute declarations nonlinearly.
253 // Currently, the only nonlinear scope is a switch statement. The name is
256 // its own lexical scope.
263 // Position in the source where this scope begins and ends.
265 // * For the scope of a with statement
269 // * For the scope of a block
273 // * For the scope of a function literal or decalaration
277 // * For the scope of a catch block
281 // * For the scope of a for-statement
285 // * For the scope of a switch statement
302 // In some cases we want to force context allocation for a whole scope.
314 // Specific scope types.
332 // Does this scope have the potential to execute declarations non-linearly?
345 // The type of this scope.
348 // The language mode of this scope.
351 // inner_scope() and sibling() together implement the inner scope list of a
352 // scope. Inner scope points to the an inner scope of the function, and
353 // "sibling" points to a next inner scope of the outer scope of this scope.
354 Scope* inner_scope() const { return inner_scope_; }
355 Scope* sibling() const { return sibling_; }
357 // The scope immediately surrounding this scope, or NULL.
358 Scope* outer_scope() const { return outer_scope_; }
376 // Determine if we can parse a function literal in this scope lazily without
378 bool AllowsLazyParsingWithoutUnresolvedVariables(const Scope* outer) const;
380 // The number of contexts between this and scope; zero if this == scope.
381 int ContextChainLength(Scope* scope) const;
387 // The maximum number of nested contexts required for this scope and any inner
391 // Find the first function, script, eval or (declaration) block scope. This is
392 // the scope where var declarations will be hoisted to in the implementation.
395 // Find the first non-block declaration scope. This should be either a script,
396 // function, or eval scope. Same as DeclarationScope(), but skips declaration
398 // the scope for which a function prologue allocates a context) or declaring
403 // Find the first (non-arrow) function or script scope. This is where
407 // Find the module scope, assuming there is one.
410 // Find the innermost outer scope that needs a context.
411 Scope* GetOuterScopeWithContext();
422 // During formal parameter list parsing the scope only contains
438 // Check that the scope has positions assigned.
441 // Check that all Scopes in the scope tree use the same Zone.
450 bool RemoveInnerScope(Scope* inner_scope) {
456 for (Scope* scope = inner_scope_; scope != nullptr;
457 scope = scope->sibling_) {
458 if (scope->sibling_ == inner_scope) {
459 scope->sibling_ = scope->sibling_->sibling_;
467 explicit Scope(Zone* zone);
490 // Scope tree.
491 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL
492 Scope* inner_scope_; // an inner scope of this scope
493 Scope* sibling_; // a sibling inner scope of the outer scope of this scope.
495 // The variables declared in this scope:
499 // an inner scope) with no intervening with statements or eval calls.
504 // Unresolved variables referred to from this scope. The proxies themselves
510 // Serialized scope info support.
516 // True if it doesn't need scope resolution (e.g., if the scope was
517 // constructed based on a serialized scope info or a catch context).
519 // True if this scope may contain objects from a temp zone that needs to be
532 // The scope type.
535 // Scope-specific information computed during parsing.
537 // The language mode of this scope.
540 // This scope or a nested catch scope or with scope contain an 'eval' call. At
541 // the 'eval' call site this scope is the declaration scope.
543 // This scope's declarations might not be executed in order (e.g., switch).
561 // scope, and stopping when reaching the outer_scope_end scope. If the code is
564 Variable* LookupRecursive(VariableProxy* proxy, Scope* outer_scope_end);
569 // Finds free variables of this scope. This mutates the unresolved variables
595 // Construct a scope based on the scope info.
596 Scope(Zone* zone, ScopeType type, Handle<ScopeInfo> scope_info);
598 // Construct a catch scope with a binding for the name.
599 Scope(Zone* zone, const AstRawString* catch_variable_name,
602 void AddInnerScope(Scope* inner_scope) {
614 class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
616 DeclarationScope(Zone* zone, Scope* outer_scope, ScopeType scope_type,
620 // Creates a script scope.
636 // Inform the scope that the corresponding code uses "super".
638 // Does this scope access "super" property (super.foo).
676 // is in an intermediate scope between this function scope and the the
677 // outer scope. Only possible for function scopes; at most one variable.
680 // declared in the scope. It will add a variable for {name} to {variables_};
690 // Declare a parameter in this scope. When there are duplicated
702 // Declare an implicit global variable in this scope which must be a
703 // script scope. The variable was introduced (possibly from an inner
704 // scope) by a reference to an unresolved variable with no intervening
716 // TODO(wingo): Add a GLOBAL_SCOPE scope type which will lexically allocate
768 // communicate that the scope is non-simple, without allocating any parameters
794 // Adds a local variable in this scope's locals list. This is for adjusting
795 // the scope of temporaries and do-expression vars when desugaring parameter
800 const AstRawString* name, Scope* scope,
803 // Go through sloppy_block_function_map_ and hoist those (into this scope)
811 // Compute top scope and allocate variables. For lazy compilation the top
812 // scope only contains the single lazily compiled function, so this
816 // To be called during parsing. Do just enough scope analysis that we can
817 // discard the Scope for lazily compiled functions. In particular, this
818 // records variables which cannot be resolved inside the Scope (we don't yet
827 // Determine if we can use lazy compilation for this scope.
866 // If the scope is a function scope, this is the function kind.
870 // This scope contains an "use asm" annotation.
872 // This scope's outer context is an asm module.
875 // This function scope has a rest parameter.
877 // This scope has a parameter called "arguments".
879 // This scope uses "super" property ('super.foo').
882 // Set to true after we have finished lazy parsing the scope.