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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 DCHECK_NOT_NULL(receiver_); | 348 DCHECK_NOT_NULL(receiver_); |
349 return receiver_; | 349 return receiver_; |
350 } | 350 } |
351 | 351 |
352 Variable* LookupThis() { return Lookup(ast_value_factory_->this_string()); } | 352 Variable* LookupThis() { return Lookup(ast_value_factory_->this_string()); } |
353 | 353 |
354 // TODO(wingo): Add a GLOBAL_SCOPE scope type which will lexically allocate | 354 // TODO(wingo): Add a GLOBAL_SCOPE scope type which will lexically allocate |
355 // "this" (and no other variable) on the native context. Script scopes then | 355 // "this" (and no other variable) on the native context. Script scopes then |
356 // will not have a "this" declaration. | 356 // will not have a "this" declaration. |
357 bool has_this_declaration() const { | 357 bool has_this_declaration() const { |
358 return (is_function_scope() && !is_arrow_scope()) || is_module_scope(); | 358 return (is_function_scope() && !is_arrow_scope()) || is_module_scope() || |
| 359 is_script_scope(); |
359 } | 360 } |
360 | 361 |
361 // The variable corresponding to the 'new.target' value. | 362 // The variable corresponding to the 'new.target' value. |
362 Variable* new_target_var() { return new_target_; } | 363 Variable* new_target_var() { return new_target_; } |
363 | 364 |
364 // The variable holding the function literal for named function | 365 // The variable holding the function literal for named function |
365 // literals, or NULL. Only valid for function scopes. | 366 // literals, or NULL. Only valid for function scopes. |
366 VariableDeclaration* function() const { | 367 VariableDeclaration* function() const { |
367 DCHECK(is_function_scope()); | 368 DCHECK(is_function_scope()); |
368 return function_; | 369 return function_; |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 PendingCompilationErrorHandler pending_error_handler_; | 766 PendingCompilationErrorHandler pending_error_handler_; |
766 | 767 |
767 // For tracking which classes are declared consecutively. Needed for strong | 768 // For tracking which classes are declared consecutively. Needed for strong |
768 // mode. | 769 // mode. |
769 int class_declaration_group_start_; | 770 int class_declaration_group_start_; |
770 }; | 771 }; |
771 | 772 |
772 } } // namespace v8::internal | 773 } } // namespace v8::internal |
773 | 774 |
774 #endif // V8_SCOPES_H_ | 775 #endif // V8_SCOPES_H_ |
OLD | NEW |