OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // Type testing & conversion | 124 // Type testing & conversion |
125 Property* AsProperty() const; | 125 Property* AsProperty() const; |
126 Slot* AsSlot() const; | 126 Slot* AsSlot() const; |
127 | 127 |
128 bool IsValidLeftHandSide() { return is_valid_LHS_; } | 128 bool IsValidLeftHandSide() { return is_valid_LHS_; } |
129 | 129 |
130 // The source code for an eval() call may refer to a variable that is | 130 // The source code for an eval() call may refer to a variable that is |
131 // in an outer scope about which we don't know anything (it may not | 131 // in an outer scope about which we don't know anything (it may not |
132 // be the global scope). scope() is NULL in that case. Currently the | 132 // be the global scope). scope() is NULL in that case. Currently the |
133 // scope is only used to follow the context chain length. | 133 // scope is only used to follow the context chain length. |
134 Scope* scope() const { return scope_; } | 134 Scope* scope() const { return scope_; } |
135 | 135 |
136 Handle<String> name() const { return name_; } | 136 Handle<String> name() const { return name_; } |
137 Mode mode() const { return mode_; } | 137 Mode mode() const { return mode_; } |
138 bool is_accessed_from_inner_scope() const { | 138 bool is_accessed_from_inner_scope() const { |
139 return is_accessed_from_inner_scope_; | 139 return is_accessed_from_inner_scope_; |
140 } | 140 } |
141 bool is_used() { return is_used_; } | 141 bool is_used() { return is_used_; } |
142 void set_is_used(bool flag) { is_used_ = flag; } | 142 void set_is_used(bool flag) { is_used_ = flag; } |
143 | 143 |
144 bool IsVariable(Handle<String> n) const { | 144 bool IsVariable(Handle<String> n) const { |
145 return !is_this() && name().is_identical_to(n); | 145 return !is_this() && name().is_identical_to(n); |
146 } | 146 } |
147 | 147 |
148 bool IsStackAllocated() const; | 148 bool IsStackAllocated() const; |
(...skipping 16 matching lines...) Expand all Loading... |
165 | 165 |
166 Variable* local_if_not_shadowed() const { | 166 Variable* local_if_not_shadowed() const { |
167 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); | 167 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); |
168 return local_if_not_shadowed_; | 168 return local_if_not_shadowed_; |
169 } | 169 } |
170 | 170 |
171 void set_local_if_not_shadowed(Variable* local) { | 171 void set_local_if_not_shadowed(Variable* local) { |
172 local_if_not_shadowed_ = local; | 172 local_if_not_shadowed_ = local; |
173 } | 173 } |
174 | 174 |
175 Expression* rewrite() const { return rewrite_; } | 175 Expression* rewrite() const { return rewrite_; } |
176 | 176 |
177 StaticType* type() { return &type_; } | 177 StaticType* type() { return &type_; } |
178 | 178 |
179 private: | 179 private: |
180 Scope* scope_; | 180 Scope* scope_; |
181 Handle<String> name_; | 181 Handle<String> name_; |
182 Mode mode_; | 182 Mode mode_; |
183 bool is_valid_LHS_; | 183 bool is_valid_LHS_; |
184 Kind kind_; | 184 Kind kind_; |
185 | 185 |
(...skipping 10 matching lines...) Expand all Loading... |
196 // rewrite_ is usually a Slot or a Property, but may be any expression. | 196 // rewrite_ is usually a Slot or a Property, but may be any expression. |
197 Expression* rewrite_; | 197 Expression* rewrite_; |
198 | 198 |
199 friend class Scope; // Has explicit access to rewrite_. | 199 friend class Scope; // Has explicit access to rewrite_. |
200 }; | 200 }; |
201 | 201 |
202 | 202 |
203 } } // namespace v8::internal | 203 } } // namespace v8::internal |
204 | 204 |
205 #endif // V8_VARIABLES_H_ | 205 #endif // V8_VARIABLES_H_ |
OLD | NEW |