| 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/hashmap.h" |
| 10 #include "src/pending-compilation-error-handler.h" | 10 #include "src/pending-compilation-error-handler.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 void AddTemporary(Variable* var) { temps_.Add(var, zone()); } | 217 void AddTemporary(Variable* var) { temps_.Add(var, zone()); } |
| 218 | 218 |
| 219 // Adds the specific declaration node to the list of declarations in | 219 // Adds the specific declaration node to the list of declarations in |
| 220 // this scope. The declarations are processed as part of entering | 220 // this scope. The declarations are processed as part of entering |
| 221 // the scope; see codegen.cc:ProcessDeclarations. | 221 // the scope; see codegen.cc:ProcessDeclarations. |
| 222 void AddDeclaration(Declaration* declaration); | 222 void AddDeclaration(Declaration* declaration); |
| 223 | 223 |
| 224 // --------------------------------------------------------------------------- | 224 // --------------------------------------------------------------------------- |
| 225 // Illegal redeclaration support. | 225 // Illegal redeclaration support. |
| 226 | 226 |
| 227 // Set an expression node that will be executed when the scope is | 227 // Check if the scope has conflicting var |
| 228 // entered. We only keep track of one illegal redeclaration node per | |
| 229 // scope - the first one - so if you try to set it multiple times | |
| 230 // the additional requests will be silently ignored. | |
| 231 void SetIllegalRedeclaration(Expression* expression); | |
| 232 | |
| 233 // Retrieve the illegal redeclaration expression. Do not call if the | |
| 234 // scope doesn't have an illegal redeclaration node. | |
| 235 Expression* GetIllegalRedeclaration(); | |
| 236 | |
| 237 // Check if the scope has (at least) one illegal redeclaration. | |
| 238 bool HasIllegalRedeclaration() const { return illegal_redecl_ != NULL; } | |
| 239 | |
| 240 // For harmony block scoping mode: Check if the scope has conflicting var | |
| 241 // declarations, i.e. a var declaration that has been hoisted from a nested | 228 // declarations, i.e. a var declaration that has been hoisted from a nested |
| 242 // scope over a let binding of the same name. | 229 // scope over a let binding of the same name. |
| 243 Declaration* CheckConflictingVarDeclarations(); | 230 Declaration* CheckConflictingVarDeclarations(); |
| 244 | 231 |
| 245 // --------------------------------------------------------------------------- | 232 // --------------------------------------------------------------------------- |
| 246 // Scope-specific info. | 233 // Scope-specific info. |
| 247 | 234 |
| 248 // Inform the scope that the corresponding code contains an eval call. | 235 // Inform the scope that the corresponding code contains an eval call. |
| 249 void RecordEvalCall() { scope_calls_eval_ = true; } | 236 void RecordEvalCall() { scope_calls_eval_ = true; } |
| 250 | 237 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 // Convenience variable; function scopes only. | 616 // Convenience variable; function scopes only. |
| 630 Variable* arguments_; | 617 Variable* arguments_; |
| 631 // Convenience variable; Subclass constructor only | 618 // Convenience variable; Subclass constructor only |
| 632 Variable* this_function_; | 619 Variable* this_function_; |
| 633 // Module descriptor; module scopes only. | 620 // Module descriptor; module scopes only. |
| 634 ModuleDescriptor* module_descriptor_; | 621 ModuleDescriptor* module_descriptor_; |
| 635 | 622 |
| 636 // Map of function names to lists of functions defined in sloppy blocks | 623 // Map of function names to lists of functions defined in sloppy blocks |
| 637 SloppyBlockFunctionMap sloppy_block_function_map_; | 624 SloppyBlockFunctionMap sloppy_block_function_map_; |
| 638 | 625 |
| 639 // Illegal redeclaration. | |
| 640 Expression* illegal_redecl_; | |
| 641 | |
| 642 // Scope-specific information computed during parsing. | 626 // Scope-specific information computed during parsing. |
| 643 // | 627 // |
| 644 // This scope is inside a 'with' of some outer scope. | 628 // This scope is inside a 'with' of some outer scope. |
| 645 bool scope_inside_with_; | 629 bool scope_inside_with_; |
| 646 // This scope or a nested catch scope or with scope contain an 'eval' call. At | 630 // This scope or a nested catch scope or with scope contain an 'eval' call. At |
| 647 // the 'eval' call site this scope is the declaration scope. | 631 // the 'eval' call site this scope is the declaration scope. |
| 648 bool scope_calls_eval_; | 632 bool scope_calls_eval_; |
| 649 // This scope uses "arguments". | 633 // This scope uses "arguments". |
| 650 bool scope_uses_arguments_; | 634 bool scope_uses_arguments_; |
| 651 // This scope uses "super" property ('super.foo'). | 635 // This scope uses "super" property ('super.foo'). |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 AstValueFactory* ast_value_factory_; | 801 AstValueFactory* ast_value_factory_; |
| 818 Zone* zone_; | 802 Zone* zone_; |
| 819 | 803 |
| 820 PendingCompilationErrorHandler pending_error_handler_; | 804 PendingCompilationErrorHandler pending_error_handler_; |
| 821 }; | 805 }; |
| 822 | 806 |
| 823 } // namespace internal | 807 } // namespace internal |
| 824 } // namespace v8 | 808 } // namespace v8 |
| 825 | 809 |
| 826 #endif // V8_AST_SCOPES_H_ | 810 #endif // V8_AST_SCOPES_H_ |
| OLD | NEW |