| 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 Isolate* isolate() const { return isolate_; } | 98 Isolate* isolate() const { return isolate_; } |
| 99 Zone* zone() const { return zone_; } | 99 Zone* zone() const { return zone_; } |
| 100 | 100 |
| 101 // --------------------------------------------------------------------------- | 101 // --------------------------------------------------------------------------- |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 337 |
| 338 // --------------------------------------------------------------------------- | 338 // --------------------------------------------------------------------------- |
| 339 // Accessors. | 339 // Accessors. |
| 340 | 340 |
| 341 // The type of this scope. | 341 // The type of this scope. |
| 342 ScopeType scope_type() const { return scope_type_; } | 342 ScopeType scope_type() const { return scope_type_; } |
| 343 | 343 |
| 344 // The language mode of this scope. | 344 // The language mode of this scope. |
| 345 LanguageMode language_mode() const { return language_mode_; } | 345 LanguageMode language_mode() const { return language_mode_; } |
| 346 | 346 |
| 347 // The variable corresponding the 'this' value. | 347 // The variable corresponding to the 'this' value. |
| 348 Variable* receiver() { return receiver_; } | 348 Variable* receiver() { return receiver_; } |
| 349 | 349 |
| 350 // The variable corresponding to the 'new.target' value. |
| 351 Variable* new_target_var() { return new_target_; } |
| 352 |
| 350 // The variable holding the function literal for named function | 353 // The variable holding the function literal for named function |
| 351 // literals, or NULL. Only valid for function scopes. | 354 // literals, or NULL. Only valid for function scopes. |
| 352 VariableDeclaration* function() const { | 355 VariableDeclaration* function() const { |
| 353 DCHECK(is_function_scope()); | 356 DCHECK(is_function_scope()); |
| 354 return function_; | 357 return function_; |
| 355 } | 358 } |
| 356 | 359 |
| 357 // Parameters. The left-most parameter has index 0. | 360 // Parameters. The left-most parameter has index 0. |
| 358 // Only valid for function scopes. | 361 // Only valid for function scopes. |
| 359 Variable* parameter(int index) const { | 362 Variable* parameter(int index) const { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 // Variables that must be looked up dynamically. | 516 // Variables that must be looked up dynamically. |
| 514 DynamicScopePart* dynamics_; | 517 DynamicScopePart* dynamics_; |
| 515 // Unresolved variables referred to from this scope. | 518 // Unresolved variables referred to from this scope. |
| 516 ZoneList<VariableProxy*> unresolved_; | 519 ZoneList<VariableProxy*> unresolved_; |
| 517 // Declarations. | 520 // Declarations. |
| 518 ZoneList<Declaration*> decls_; | 521 ZoneList<Declaration*> decls_; |
| 519 // Convenience variable. | 522 // Convenience variable. |
| 520 Variable* receiver_; | 523 Variable* receiver_; |
| 521 // Function variable, if any; function scopes only. | 524 // Function variable, if any; function scopes only. |
| 522 VariableDeclaration* function_; | 525 VariableDeclaration* function_; |
| 526 // new.target variable, function scopes only. |
| 527 Variable* new_target_; |
| 523 // Convenience variable; function scopes only. | 528 // Convenience variable; function scopes only. |
| 524 Variable* arguments_; | 529 Variable* arguments_; |
| 525 // Interface; module scopes only. | 530 // Interface; module scopes only. |
| 526 Interface* interface_; | 531 Interface* interface_; |
| 527 | 532 |
| 528 // Illegal redeclaration. | 533 // Illegal redeclaration. |
| 529 Expression* illegal_redecl_; | 534 Expression* illegal_redecl_; |
| 530 | 535 |
| 531 // Scope-specific information computed during parsing. | 536 // Scope-specific information computed during parsing. |
| 532 // | 537 // |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 Scope* outer_scope, | 707 Scope* outer_scope, |
| 703 Handle<ScopeInfo> scope_info); | 708 Handle<ScopeInfo> scope_info); |
| 704 | 709 |
| 705 AstValueFactory* ast_value_factory_; | 710 AstValueFactory* ast_value_factory_; |
| 706 Zone* zone_; | 711 Zone* zone_; |
| 707 }; | 712 }; |
| 708 | 713 |
| 709 } } // namespace v8::internal | 714 } } // namespace v8::internal |
| 710 | 715 |
| 711 #endif // V8_SCOPES_H_ | 716 #endif // V8_SCOPES_H_ |
| OLD | NEW |