| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; } | 274 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; } |
| 275 bool is_function_scope() const { | 275 bool is_function_scope() const { |
| 276 return scope_type_ == FUNCTION_SCOPE || scope_type_ == ARROW_SCOPE; | 276 return scope_type_ == FUNCTION_SCOPE || scope_type_ == ARROW_SCOPE; |
| 277 } | 277 } |
| 278 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; } | 278 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; } |
| 279 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; } | 279 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; } |
| 280 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; } | 280 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; } |
| 281 bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; } | 281 bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; } |
| 282 bool is_with_scope() const { return scope_type_ == WITH_SCOPE; } | 282 bool is_with_scope() const { return scope_type_ == WITH_SCOPE; } |
| 283 bool is_arrow_scope() const { return scope_type_ == ARROW_SCOPE; } | 283 bool is_arrow_scope() const { return scope_type_ == ARROW_SCOPE; } |
| 284 bool is_class_scope() const { return scope_type_ == CLASS_SCOPE; } |
| 284 bool is_declaration_scope() const { | 285 bool is_declaration_scope() const { |
| 285 return is_eval_scope() || is_function_scope() || | 286 return is_eval_scope() || is_function_scope() || |
| 286 is_module_scope() || is_script_scope(); | 287 is_module_scope() || is_script_scope(); |
| 287 } | 288 } |
| 288 bool is_strict_eval_scope() const { | 289 bool is_strict_eval_scope() const { |
| 289 return is_eval_scope() && is_strict(language_mode_); | 290 return is_eval_scope() && is_strict(language_mode_); |
| 290 } | 291 } |
| 291 | 292 |
| 292 // Information about which scopes calls eval. | 293 // Information about which scopes calls eval. |
| 293 bool calls_eval() const { return scope_calls_eval_; } | 294 bool calls_eval() const { return scope_calls_eval_; } |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 // parameter should be set to the calling context of 'eval'. | 652 // parameter should be set to the calling context of 'eval'. |
| 652 Variable* LookupRecursive(VariableProxy* proxy, BindingKind* binding_kind, | 653 Variable* LookupRecursive(VariableProxy* proxy, BindingKind* binding_kind, |
| 653 AstNodeFactory* factory); | 654 AstNodeFactory* factory); |
| 654 MUST_USE_RESULT | 655 MUST_USE_RESULT |
| 655 bool ResolveVariable(CompilationInfo* info, VariableProxy* proxy, | 656 bool ResolveVariable(CompilationInfo* info, VariableProxy* proxy, |
| 656 AstNodeFactory* factory); | 657 AstNodeFactory* factory); |
| 657 MUST_USE_RESULT | 658 MUST_USE_RESULT |
| 658 bool ResolveVariablesRecursively(CompilationInfo* info, | 659 bool ResolveVariablesRecursively(CompilationInfo* info, |
| 659 AstNodeFactory* factory); | 660 AstNodeFactory* factory); |
| 660 | 661 |
| 662 bool CheckStrongModeDeclaration(VariableProxy* proxy, Variable* var); |
| 663 |
| 661 // Scope analysis. | 664 // Scope analysis. |
| 662 void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval); | 665 void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval); |
| 663 bool HasTrivialContext() const; | 666 bool HasTrivialContext() const; |
| 664 | 667 |
| 665 // Predicates. | 668 // Predicates. |
| 666 bool MustAllocate(Variable* var); | 669 bool MustAllocate(Variable* var); |
| 667 bool MustAllocateInContext(Variable* var); | 670 bool MustAllocateInContext(Variable* var); |
| 668 bool HasArgumentsParameter(Isolate* isolate); | 671 bool HasArgumentsParameter(Isolate* isolate); |
| 669 | 672 |
| 670 // Variable allocation. | 673 // Variable allocation. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 | 712 |
| 710 AstValueFactory* ast_value_factory_; | 713 AstValueFactory* ast_value_factory_; |
| 711 Zone* zone_; | 714 Zone* zone_; |
| 712 | 715 |
| 713 PendingCompilationErrorHandler pending_error_handler_; | 716 PendingCompilationErrorHandler pending_error_handler_; |
| 714 }; | 717 }; |
| 715 | 718 |
| 716 } } // namespace v8::internal | 719 } } // namespace v8::internal |
| 717 | 720 |
| 718 #endif // V8_SCOPES_H_ | 721 #endif // V8_SCOPES_H_ |
| OLD | NEW |