OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_SCOPES_H_ | 5 #ifndef V8_SCOPES_H_ |
6 #define V8_SCOPES_H_ | 6 #define V8_SCOPES_H_ |
7 | 7 |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/pending-compilation-error-handler.h" | 9 #include "src/pending-compilation-error-handler.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 | 476 |
477 // Determine if we can use lazy compilation for this scope without a context. | 477 // Determine if we can use lazy compilation for this scope without a context. |
478 bool AllowsLazyCompilationWithoutContext() const; | 478 bool AllowsLazyCompilationWithoutContext() const; |
479 | 479 |
480 // True if the outer context of this scope is always the native context. | 480 // True if the outer context of this scope is always the native context. |
481 bool HasTrivialOuterContext() const; | 481 bool HasTrivialOuterContext() const; |
482 | 482 |
483 // The number of contexts between this and scope; zero if this == scope. | 483 // The number of contexts between this and scope; zero if this == scope. |
484 int ContextChainLength(Scope* scope); | 484 int ContextChainLength(Scope* scope); |
485 | 485 |
486 // Find the script scope. | 486 // Find the first function, script, or eval scope. This is the scope |
adamk
2015/07/22 20:55:50
Can you fully fix this comment while you're here t
rossberg
2015/07/23 09:33:58
Done.
| |
487 // Used in modules implemenetation to find hosting scope. | |
488 // TODO(rossberg): is this needed? | |
489 Scope* ScriptScope(); | |
490 | |
491 // Find the first function, global, or eval scope. This is the scope | |
492 // where var declarations will be hoisted to in the implementation. | 487 // where var declarations will be hoisted to in the implementation. |
493 Scope* DeclarationScope(); | 488 Scope* DeclarationScope(); |
494 | 489 |
490 // Find the first (non-arrow) function or script scope. This is where | |
491 // 'this' is bound, and what determines the function kind. | |
492 Scope* ReceiverScope(); | |
493 | |
495 Handle<ScopeInfo> GetScopeInfo(Isolate* isolate); | 494 Handle<ScopeInfo> GetScopeInfo(Isolate* isolate); |
496 | 495 |
497 // Get the chain of nested scopes within this scope for the source statement | 496 // Get the chain of nested scopes within this scope for the source statement |
498 // position. The scopes will be added to the list from the outermost scope to | 497 // position. The scopes will be added to the list from the outermost scope to |
499 // the innermost scope. Only nested block, catch or with scopes are tracked | 498 // the innermost scope. Only nested block, catch or with scopes are tracked |
500 // and will be returned, but no inner function scopes. | 499 // and will be returned, but no inner function scopes. |
501 void GetNestedScopeChain(Isolate* isolate, List<Handle<ScopeInfo> >* chain, | 500 void GetNestedScopeChain(Isolate* isolate, List<Handle<ScopeInfo> >* chain, |
502 int statement_position); | 501 int statement_position); |
503 | 502 |
504 // --------------------------------------------------------------------------- | 503 // --------------------------------------------------------------------------- |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
766 PendingCompilationErrorHandler pending_error_handler_; | 765 PendingCompilationErrorHandler pending_error_handler_; |
767 | 766 |
768 // For tracking which classes are declared consecutively. Needed for strong | 767 // For tracking which classes are declared consecutively. Needed for strong |
769 // mode. | 768 // mode. |
770 int class_declaration_group_start_; | 769 int class_declaration_group_start_; |
771 }; | 770 }; |
772 | 771 |
773 } } // namespace v8::internal | 772 } } // namespace v8::internal |
774 | 773 |
775 #endif // V8_SCOPES_H_ | 774 #endif // V8_SCOPES_H_ |
OLD | NEW |