| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 // The language mode of this scope. | 379 // The language mode of this scope. |
| 380 LanguageMode language_mode() const { return language_mode_; } | 380 LanguageMode language_mode() const { return language_mode_; } |
| 381 | 381 |
| 382 // The variable corresponding to the 'this' value. | 382 // The variable corresponding to the 'this' value. |
| 383 Variable* receiver() { | 383 Variable* receiver() { |
| 384 DCHECK(has_this_declaration()); | 384 DCHECK(has_this_declaration()); |
| 385 DCHECK_NOT_NULL(receiver_); | 385 DCHECK_NOT_NULL(receiver_); |
| 386 return receiver_; | 386 return receiver_; |
| 387 } | 387 } |
| 388 | 388 |
| 389 Variable* LookupThis() { return Lookup(ast_value_factory_->this_string()); } | |
| 390 | |
| 391 // TODO(wingo): Add a GLOBAL_SCOPE scope type which will lexically allocate | 389 // TODO(wingo): Add a GLOBAL_SCOPE scope type which will lexically allocate |
| 392 // "this" (and no other variable) on the native context. Script scopes then | 390 // "this" (and no other variable) on the native context. Script scopes then |
| 393 // will not have a "this" declaration. | 391 // will not have a "this" declaration. |
| 394 bool has_this_declaration() const { | 392 bool has_this_declaration() const { |
| 395 return (is_function_scope() && !is_arrow_scope()) || is_module_scope(); | 393 return (is_function_scope() && !is_arrow_scope()) || is_module_scope(); |
| 396 } | 394 } |
| 397 | 395 |
| 398 // The variable corresponding to the 'new.target' value. | 396 // The variable corresponding to the 'new.target' value. |
| 399 Variable* new_target_var() { return new_target_; } | 397 Variable* new_target_var() { return new_target_; } |
| 400 | 398 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 | 838 |
| 841 // For tracking which classes are declared consecutively. Needed for strong | 839 // For tracking which classes are declared consecutively. Needed for strong |
| 842 // mode. | 840 // mode. |
| 843 int class_declaration_group_start_; | 841 int class_declaration_group_start_; |
| 844 }; | 842 }; |
| 845 | 843 |
| 846 } // namespace internal | 844 } // namespace internal |
| 847 } // namespace v8 | 845 } // namespace v8 |
| 848 | 846 |
| 849 #endif // V8_SCOPES_H_ | 847 #endif // V8_SCOPES_H_ |
| OLD | NEW |