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_VARIABLES_H_ | 5 #ifndef V8_VARIABLES_H_ |
6 #define V8_VARIABLES_H_ | 6 #define V8_VARIABLES_H_ |
7 | 7 |
8 #include "src/ast-value-factory.h" | 8 #include "src/ast-value-factory.h" |
9 #include "src/zone.h" | 9 #include "src/zone.h" |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 // The source code for an eval() call may refer to a variable that is | 61 // The source code for an eval() call may refer to a variable that is |
62 // in an outer scope about which we don't know anything (it may not | 62 // in an outer scope about which we don't know anything (it may not |
63 // be the script scope). scope() is NULL in that case. Currently the | 63 // be the script scope). scope() is NULL in that case. Currently the |
64 // scope is only used to follow the context chain length. | 64 // scope is only used to follow the context chain length. |
65 Scope* scope() const { return scope_; } | 65 Scope* scope() const { return scope_; } |
66 | 66 |
67 Handle<String> name() const { return name_->string(); } | 67 Handle<String> name() const { return name_->string(); } |
68 const AstRawString* raw_name() const { return name_; } | 68 const AstRawString* raw_name() const { return name_; } |
69 VariableMode mode() const { return mode_; } | 69 VariableMode mode() const { return mode_; } |
| 70 void set_mode(VariableMode mode) { |
| 71 // Don't use this unless you have a very good reason |
| 72 mode_ = mode; |
| 73 } |
70 bool has_forced_context_allocation() const { | 74 bool has_forced_context_allocation() const { |
71 return force_context_allocation_; | 75 return force_context_allocation_; |
72 } | 76 } |
73 void ForceContextAllocation() { | 77 void ForceContextAllocation() { |
74 DCHECK(mode_ != TEMPORARY); | 78 DCHECK(mode_ != TEMPORARY); |
75 force_context_allocation_ = true; | 79 force_context_allocation_ = true; |
76 } | 80 } |
77 bool is_used() { return is_used_; } | 81 bool is_used() { return is_used_; } |
78 void set_is_used() { is_used_ = true; } | 82 void set_is_used() { is_used_ = true; } |
79 MaybeAssignedFlag maybe_assigned() const { return maybe_assigned_; } | 83 MaybeAssignedFlag maybe_assigned() const { return maybe_assigned_; } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 205 |
202 private: | 206 private: |
203 // For classes we keep track of consecutive groups of delcarations. They are | 207 // For classes we keep track of consecutive groups of delcarations. They are |
204 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement | 208 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement |
205 // checks for functions too. | 209 // checks for functions too. |
206 int declaration_group_start_; | 210 int declaration_group_start_; |
207 }; | 211 }; |
208 } } // namespace v8::internal | 212 } } // namespace v8::internal |
209 | 213 |
210 #endif // V8_VARIABLES_H_ | 214 #endif // V8_VARIABLES_H_ |
OLD | NEW |