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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; } | 314 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; } |
315 bool is_function_scope() const { return scope_type_ == FUNCTION_SCOPE; } | 315 bool is_function_scope() const { return scope_type_ == FUNCTION_SCOPE; } |
316 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; } | 316 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; } |
317 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; } | 317 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; } |
318 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; } | 318 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; } |
319 bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; } | 319 bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; } |
320 bool is_with_scope() const { return scope_type_ == WITH_SCOPE; } | 320 bool is_with_scope() const { return scope_type_ == WITH_SCOPE; } |
321 bool is_arrow_scope() const { | 321 bool is_arrow_scope() const { |
322 return is_function_scope() && IsArrowFunction(function_kind_); | 322 return is_function_scope() && IsArrowFunction(function_kind_); |
323 } | 323 } |
| 324 bool is_toplevel_scope() const { |
| 325 return is_script_scope() || is_eval_scope() || is_module_scope(); |
| 326 } |
324 bool is_declaration_scope() const { return is_declaration_scope_; } | 327 bool is_declaration_scope() const { return is_declaration_scope_; } |
325 | 328 |
326 void set_is_declaration_scope() { is_declaration_scope_ = true; } | 329 void set_is_declaration_scope() { is_declaration_scope_ = true; } |
327 | 330 |
328 // Information about which scopes calls eval. | 331 // Information about which scopes calls eval. |
329 bool calls_eval() const { return scope_calls_eval_; } | 332 bool calls_eval() const { return scope_calls_eval_; } |
330 bool calls_sloppy_eval() const { | 333 bool calls_sloppy_eval() const { |
331 return scope_calls_eval_ && is_sloppy(language_mode_); | 334 return scope_calls_eval_ && is_sloppy(language_mode_); |
332 } | 335 } |
333 bool outer_scope_calls_sloppy_eval() const { | 336 bool outer_scope_calls_sloppy_eval() const { |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 AstValueFactory* ast_value_factory_; | 810 AstValueFactory* ast_value_factory_; |
808 Zone* zone_; | 811 Zone* zone_; |
809 | 812 |
810 PendingCompilationErrorHandler pending_error_handler_; | 813 PendingCompilationErrorHandler pending_error_handler_; |
811 }; | 814 }; |
812 | 815 |
813 } // namespace internal | 816 } // namespace internal |
814 } // namespace v8 | 817 } // namespace v8 |
815 | 818 |
816 #endif // V8_AST_SCOPES_H_ | 819 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |