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/zone.h" | 9 #include "src/zone.h" |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 static bool Analyze(CompilationInfo* info); | 81 static bool Analyze(CompilationInfo* info); |
82 | 82 |
83 static Scope* DeserializeScopeChain(Isolate* isolate, Zone* zone, | 83 static Scope* DeserializeScopeChain(Isolate* isolate, Zone* zone, |
84 Context* context, Scope* script_scope); | 84 Context* context, Scope* script_scope); |
85 | 85 |
86 // The scope name is only used for printing/debugging. | 86 // The scope name is only used for printing/debugging. |
87 void SetScopeName(const AstRawString* scope_name) { | 87 void SetScopeName(const AstRawString* scope_name) { |
88 scope_name_ = scope_name; | 88 scope_name_ = scope_name; |
89 } | 89 } |
90 | 90 |
91 void Initialize(bool uninitialized_this = false); | 91 void Initialize(bool subclass_constructor = false); |
92 | 92 |
93 // Checks if the block scope is redundant, i.e. it does not contain any | 93 // Checks if the block scope is redundant, i.e. it does not contain any |
94 // block scoped declarations. In that case it is removed from the scope | 94 // block scoped declarations. In that case it is removed from the scope |
95 // tree and its children are reparented. | 95 // tree and its children are reparented. |
96 Scope* FinalizeBlockScope(); | 96 Scope* FinalizeBlockScope(); |
97 | 97 |
98 Zone* zone() const { return zone_; } | 98 Zone* zone() const { return zone_; } |
99 | 99 |
100 // --------------------------------------------------------------------------- | 100 // --------------------------------------------------------------------------- |
101 // Declarations | 101 // Declarations |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 336 |
337 // --------------------------------------------------------------------------- | 337 // --------------------------------------------------------------------------- |
338 // Accessors. | 338 // Accessors. |
339 | 339 |
340 // The type of this scope. | 340 // The type of this scope. |
341 ScopeType scope_type() const { return scope_type_; } | 341 ScopeType scope_type() const { return scope_type_; } |
342 | 342 |
343 // The language mode of this scope. | 343 // The language mode of this scope. |
344 LanguageMode language_mode() const { return language_mode_; } | 344 LanguageMode language_mode() const { return language_mode_; } |
345 | 345 |
346 // The variable corresponding the 'this' value. | 346 // The variable corresponding to the 'this' value. |
347 Variable* receiver() { return receiver_; } | 347 Variable* receiver() { return receiver_; } |
348 | 348 |
| 349 // The variable corresponding to the 'new.target' value. |
| 350 Variable* new_target_var() { return new_target_; } |
| 351 |
349 // The variable holding the function literal for named function | 352 // The variable holding the function literal for named function |
350 // literals, or NULL. Only valid for function scopes. | 353 // literals, or NULL. Only valid for function scopes. |
351 VariableDeclaration* function() const { | 354 VariableDeclaration* function() const { |
352 DCHECK(is_function_scope()); | 355 DCHECK(is_function_scope()); |
353 return function_; | 356 return function_; |
354 } | 357 } |
355 | 358 |
356 // Parameters. The left-most parameter has index 0. | 359 // Parameters. The left-most parameter has index 0. |
357 // Only valid for function scopes. | 360 // Only valid for function scopes. |
358 Variable* parameter(int index) const { | 361 Variable* parameter(int index) const { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 // Variables that must be looked up dynamically. | 513 // Variables that must be looked up dynamically. |
511 DynamicScopePart* dynamics_; | 514 DynamicScopePart* dynamics_; |
512 // Unresolved variables referred to from this scope. | 515 // Unresolved variables referred to from this scope. |
513 ZoneList<VariableProxy*> unresolved_; | 516 ZoneList<VariableProxy*> unresolved_; |
514 // Declarations. | 517 // Declarations. |
515 ZoneList<Declaration*> decls_; | 518 ZoneList<Declaration*> decls_; |
516 // Convenience variable. | 519 // Convenience variable. |
517 Variable* receiver_; | 520 Variable* receiver_; |
518 // Function variable, if any; function scopes only. | 521 // Function variable, if any; function scopes only. |
519 VariableDeclaration* function_; | 522 VariableDeclaration* function_; |
| 523 // new.target variable, function scopes only. |
| 524 Variable* new_target_; |
520 // Convenience variable; function scopes only. | 525 // Convenience variable; function scopes only. |
521 Variable* arguments_; | 526 Variable* arguments_; |
522 // Interface; module scopes only. | 527 // Interface; module scopes only. |
523 Interface* interface_; | 528 Interface* interface_; |
524 | 529 |
525 // Illegal redeclaration. | 530 // Illegal redeclaration. |
526 Expression* illegal_redecl_; | 531 Expression* illegal_redecl_; |
527 | 532 |
528 // Scope-specific information computed during parsing. | 533 // Scope-specific information computed during parsing. |
529 // | 534 // |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 Scope* outer_scope, | 703 Scope* outer_scope, |
699 Handle<ScopeInfo> scope_info); | 704 Handle<ScopeInfo> scope_info); |
700 | 705 |
701 AstValueFactory* ast_value_factory_; | 706 AstValueFactory* ast_value_factory_; |
702 Zone* zone_; | 707 Zone* zone_; |
703 }; | 708 }; |
704 | 709 |
705 } } // namespace v8::internal | 710 } } // namespace v8::internal |
706 | 711 |
707 #endif // V8_SCOPES_H_ | 712 #endif // V8_SCOPES_H_ |
OLD | NEW |