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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 | 482 |
483 // Find the script scope. | 483 // Find the script scope. |
484 // Used in modules implemenetation to find hosting scope. | 484 // Used in modules implemenetation to find hosting scope. |
485 // TODO(rossberg): is this needed? | 485 // TODO(rossberg): is this needed? |
486 Scope* ScriptScope(); | 486 Scope* ScriptScope(); |
487 | 487 |
488 // Find the first function, global, or eval scope. This is the scope | 488 // Find the first function, global, or eval scope. This is the scope |
489 // where var declarations will be hoisted to in the implementation. | 489 // where var declarations will be hoisted to in the implementation. |
490 Scope* DeclarationScope(); | 490 Scope* DeclarationScope(); |
491 | 491 |
492 // Find the first non-block declaration scope. This should be either a global, | |
493 // eval or function top scope. Used for declaring temporaries | |
494 Scope* TempScope() { | |
495 Scope* s = DeclarationScope(); | |
496 if (s->is_block_scope()) { | |
497 s = s->outer_scope(); | |
rossberg
2015/07/17 08:38:05
We may potentially want to use declaration blocks
caitp (gmail)
2015/07/17 15:43:23
done in refactor
| |
498 DCHECK(s->is_function_scope()); | |
499 } | |
500 return s; | |
501 } | |
502 | |
492 Handle<ScopeInfo> GetScopeInfo(Isolate* isolate); | 503 Handle<ScopeInfo> GetScopeInfo(Isolate* isolate); |
493 | 504 |
494 // Get the chain of nested scopes within this scope for the source statement | 505 // Get the chain of nested scopes within this scope for the source statement |
495 // position. The scopes will be added to the list from the outermost scope to | 506 // position. The scopes will be added to the list from the outermost scope to |
496 // the innermost scope. Only nested block, catch or with scopes are tracked | 507 // the innermost scope. Only nested block, catch or with scopes are tracked |
497 // and will be returned, but no inner function scopes. | 508 // and will be returned, but no inner function scopes. |
498 void GetNestedScopeChain(Isolate* isolate, List<Handle<ScopeInfo> >* chain, | 509 void GetNestedScopeChain(Isolate* isolate, List<Handle<ScopeInfo> >* chain, |
499 int statement_position); | 510 int statement_position); |
500 | 511 |
501 // --------------------------------------------------------------------------- | 512 // --------------------------------------------------------------------------- |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
763 PendingCompilationErrorHandler pending_error_handler_; | 774 PendingCompilationErrorHandler pending_error_handler_; |
764 | 775 |
765 // For tracking which classes are declared consecutively. Needed for strong | 776 // For tracking which classes are declared consecutively. Needed for strong |
766 // mode. | 777 // mode. |
767 int class_declaration_group_start_; | 778 int class_declaration_group_start_; |
768 }; | 779 }; |
769 | 780 |
770 } } // namespace v8::internal | 781 } } // namespace v8::internal |
771 | 782 |
772 #endif // V8_SCOPES_H_ | 783 #endif // V8_SCOPES_H_ |
OLD | NEW |