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 } | |
74 bool has_forced_context_allocation() const { | 70 bool has_forced_context_allocation() const { |
75 return force_context_allocation_; | 71 return force_context_allocation_; |
76 } | 72 } |
77 void ForceContextAllocation() { | 73 void ForceContextAllocation() { |
78 DCHECK(mode_ != TEMPORARY); | 74 DCHECK(mode_ != TEMPORARY); |
79 force_context_allocation_ = true; | 75 force_context_allocation_ = true; |
80 } | 76 } |
81 bool is_used() { return is_used_; } | 77 bool is_used() { return is_used_; } |
82 void set_is_used() { is_used_ = true; } | 78 void set_is_used() { is_used_ = true; } |
83 MaybeAssignedFlag maybe_assigned() const { return maybe_assigned_; } | 79 MaybeAssignedFlag maybe_assigned() const { return maybe_assigned_; } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 201 |
206 private: | 202 private: |
207 // For classes we keep track of consecutive groups of delcarations. They are | 203 // For classes we keep track of consecutive groups of delcarations. They are |
208 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement | 204 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement |
209 // checks for functions too. | 205 // checks for functions too. |
210 int declaration_group_start_; | 206 int declaration_group_start_; |
211 }; | 207 }; |
212 } } // namespace v8::internal | 208 } } // namespace v8::internal |
213 | 209 |
214 #endif // V8_VARIABLES_H_ | 210 #endif // V8_VARIABLES_H_ |
OLD | NEW |