| 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_AST_SCOPES_H_ | 5 #ifndef V8_AST_SCOPES_H_ |
| 6 #define V8_AST_SCOPES_H_ | 6 #define V8_AST_SCOPES_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/hashmap.h" |
| 9 #include "src/pending-compilation-error-handler.h" | 10 #include "src/pending-compilation-error-handler.h" |
| 10 #include "src/zone.h" | 11 #include "src/zone.h" |
| 11 | 12 |
| 12 namespace v8 { | 13 namespace v8 { |
| 13 namespace internal { | 14 namespace internal { |
| 14 | 15 |
| 15 class ParseInfo; | 16 class ParseInfo; |
| 16 | 17 |
| 17 // A hash map to support fast variable declaration and lookup. | 18 // A hash map to support fast variable declaration and lookup. |
| 18 class VariableMap: public ZoneHashMap { | 19 class VariableMap: public ZoneHashMap { |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 | 539 |
| 539 Handle<ScopeInfo> GetScopeInfo(Isolate* isolate); | 540 Handle<ScopeInfo> GetScopeInfo(Isolate* isolate); |
| 540 | 541 |
| 541 // Get the chain of nested scopes within this scope for the source statement | 542 // Get the chain of nested scopes within this scope for the source statement |
| 542 // position. The scopes will be added to the list from the outermost scope to | 543 // position. The scopes will be added to the list from the outermost scope to |
| 543 // the innermost scope. Only nested block, catch or with scopes are tracked | 544 // the innermost scope. Only nested block, catch or with scopes are tracked |
| 544 // and will be returned, but no inner function scopes. | 545 // and will be returned, but no inner function scopes. |
| 545 void GetNestedScopeChain(Isolate* isolate, List<Handle<ScopeInfo> >* chain, | 546 void GetNestedScopeChain(Isolate* isolate, List<Handle<ScopeInfo> >* chain, |
| 546 int statement_position); | 547 int statement_position); |
| 547 | 548 |
| 549 void CollectNonLocals(HashMap* non_locals); |
| 550 |
| 548 // --------------------------------------------------------------------------- | 551 // --------------------------------------------------------------------------- |
| 549 // Strict mode support. | 552 // Strict mode support. |
| 550 bool IsDeclared(const AstRawString* name) { | 553 bool IsDeclared(const AstRawString* name) { |
| 551 // During formal parameter list parsing the scope only contains | 554 // During formal parameter list parsing the scope only contains |
| 552 // two variables inserted at initialization: "this" and "arguments". | 555 // two variables inserted at initialization: "this" and "arguments". |
| 553 // "this" is an invalid parameter name and "arguments" is invalid parameter | 556 // "this" is an invalid parameter name and "arguments" is invalid parameter |
| 554 // name in strict mode. Therefore looking up with the map which includes | 557 // name in strict mode. Therefore looking up with the map which includes |
| 555 // "this" and "arguments" in addition to all formal parameters is safe. | 558 // "this" and "arguments" in addition to all formal parameters is safe. |
| 556 return variables_.Lookup(name) != NULL; | 559 return variables_.Lookup(name) != NULL; |
| 557 } | 560 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 | 821 |
| 819 // For tracking which classes are declared consecutively. Needed for strong | 822 // For tracking which classes are declared consecutively. Needed for strong |
| 820 // mode. | 823 // mode. |
| 821 int class_declaration_group_start_; | 824 int class_declaration_group_start_; |
| 822 }; | 825 }; |
| 823 | 826 |
| 824 } // namespace internal | 827 } // namespace internal |
| 825 } // namespace v8 | 828 } // namespace v8 |
| 826 | 829 |
| 827 #endif // V8_AST_SCOPES_H_ | 830 #endif // V8_AST_SCOPES_H_ |
| OLD | NEW |