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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 bool HasIllegalRedeclaration() const { return illegal_redecl_ != NULL; } | 238 bool HasIllegalRedeclaration() const { return illegal_redecl_ != NULL; } |
239 | 239 |
240 // For harmony block scoping mode: Check if the scope has conflicting var | 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 | 241 // declarations, i.e. a var declaration that has been hoisted from a nested |
242 // scope over a let binding of the same name. | 242 // scope over a let binding of the same name. |
243 Declaration* CheckConflictingVarDeclarations(); | 243 Declaration* CheckConflictingVarDeclarations(); |
244 | 244 |
245 // --------------------------------------------------------------------------- | 245 // --------------------------------------------------------------------------- |
246 // Scope-specific info. | 246 // Scope-specific info. |
247 | 247 |
248 // Inform the scope that the corresponding code contains a with statement. | |
249 void RecordWithStatement() { scope_contains_with_ = true; } | |
250 | |
251 // Inform the scope that the corresponding code contains an eval call. | 248 // Inform the scope that the corresponding code contains an eval call. |
252 void RecordEvalCall() { scope_calls_eval_ = true; } | 249 void RecordEvalCall() { scope_calls_eval_ = true; } |
253 | 250 |
254 // Inform the scope that the corresponding code uses "arguments". | 251 // Inform the scope that the corresponding code uses "arguments". |
255 void RecordArgumentsUsage() { scope_uses_arguments_ = true; } | 252 void RecordArgumentsUsage() { scope_uses_arguments_ = true; } |
256 | 253 |
257 // Inform the scope that the corresponding code uses "super". | 254 // Inform the scope that the corresponding code uses "super". |
258 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; } | 255 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; } |
259 | 256 |
260 // Set the language mode flag (unless disabled by a global flag). | 257 // Set the language mode flag (unless disabled by a global flag). |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 // Map of function names to lists of functions defined in sloppy blocks | 636 // Map of function names to lists of functions defined in sloppy blocks |
640 SloppyBlockFunctionMap sloppy_block_function_map_; | 637 SloppyBlockFunctionMap sloppy_block_function_map_; |
641 | 638 |
642 // Illegal redeclaration. | 639 // Illegal redeclaration. |
643 Expression* illegal_redecl_; | 640 Expression* illegal_redecl_; |
644 | 641 |
645 // Scope-specific information computed during parsing. | 642 // Scope-specific information computed during parsing. |
646 // | 643 // |
647 // This scope is inside a 'with' of some outer scope. | 644 // This scope is inside a 'with' of some outer scope. |
648 bool scope_inside_with_; | 645 bool scope_inside_with_; |
649 // This scope contains a 'with' statement. | |
650 bool scope_contains_with_; | |
651 // This scope or a nested catch scope or with scope contain an 'eval' call. At | 646 // This scope or a nested catch scope or with scope contain an 'eval' call. At |
652 // the 'eval' call site this scope is the declaration scope. | 647 // the 'eval' call site this scope is the declaration scope. |
653 bool scope_calls_eval_; | 648 bool scope_calls_eval_; |
654 // This scope uses "arguments". | 649 // This scope uses "arguments". |
655 bool scope_uses_arguments_; | 650 bool scope_uses_arguments_; |
656 // This scope uses "super" property ('super.foo'). | 651 // This scope uses "super" property ('super.foo'). |
657 bool scope_uses_super_property_; | 652 bool scope_uses_super_property_; |
658 // This scope contains an "use asm" annotation. | 653 // This scope contains an "use asm" annotation. |
659 bool asm_module_; | 654 bool asm_module_; |
660 // This scope's outer context is an asm module. | 655 // This scope's outer context is an asm module. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 AstValueFactory* ast_value_factory_; | 817 AstValueFactory* ast_value_factory_; |
823 Zone* zone_; | 818 Zone* zone_; |
824 | 819 |
825 PendingCompilationErrorHandler pending_error_handler_; | 820 PendingCompilationErrorHandler pending_error_handler_; |
826 }; | 821 }; |
827 | 822 |
828 } // namespace internal | 823 } // namespace internal |
829 } // namespace v8 | 824 } // namespace v8 |
830 | 825 |
831 #endif // V8_AST_SCOPES_H_ | 826 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |