OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_VARIABLES_H_ | 5 #ifndef V8_AST_VARIABLES_H_ |
6 #define V8_AST_VARIABLES_H_ | 6 #define V8_AST_VARIABLES_H_ |
7 | 7 |
8 #include "src/ast/ast-value-factory.h" | 8 #include "src/ast/ast-value-factory.h" |
9 #include "src/zone.h" | 9 #include "src/zone.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Printing support | 31 // Printing support |
32 static const char* Mode2String(VariableMode mode); | 32 static const char* Mode2String(VariableMode mode); |
33 | 33 |
34 // The source code for an eval() call may refer to a variable that is | 34 // The source code for an eval() call may refer to a variable that is |
35 // in an outer scope about which we don't know anything (it may not | 35 // in an outer scope about which we don't know anything (it may not |
36 // be the script scope). scope() is NULL in that case. Currently the | 36 // be the script scope). scope() is NULL in that case. Currently the |
37 // scope is only used to follow the context chain length. | 37 // scope is only used to follow the context chain length. |
38 Scope* scope() const { return scope_; } | 38 Scope* scope() const { return scope_; } |
39 | 39 |
| 40 // This is for adjusting the scope of temporaries used when desugaring |
| 41 // parameter initializers. |
| 42 void set_scope(Scope* scope) { scope_ = scope; } |
| 43 |
40 Handle<String> name() const { return name_->string(); } | 44 Handle<String> name() const { return name_->string(); } |
41 const AstRawString* raw_name() const { return name_; } | 45 const AstRawString* raw_name() const { return name_; } |
42 VariableMode mode() const { return mode_; } | 46 VariableMode mode() const { return mode_; } |
43 bool has_forced_context_allocation() const { | 47 bool has_forced_context_allocation() const { |
44 return force_context_allocation_; | 48 return force_context_allocation_; |
45 } | 49 } |
46 void ForceContextAllocation() { | 50 void ForceContextAllocation() { |
47 force_context_allocation_ = true; | 51 force_context_allocation_ = true; |
48 } | 52 } |
49 bool is_used() { return is_used_; } | 53 bool is_used() { return is_used_; } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 private: | 209 private: |
206 // For classes we keep track of consecutive groups of delcarations. They are | 210 // For classes we keep track of consecutive groups of delcarations. They are |
207 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement | 211 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement |
208 // checks for functions too. | 212 // checks for functions too. |
209 int declaration_group_start_; | 213 int declaration_group_start_; |
210 }; | 214 }; |
211 } // namespace internal | 215 } // namespace internal |
212 } // namespace v8 | 216 } // namespace v8 |
213 | 217 |
214 #endif // V8_AST_VARIABLES_H_ | 218 #endif // V8_AST_VARIABLES_H_ |
OLD | NEW |