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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // Type testing & conversion | 155 // Type testing & conversion |
156 Property* AsProperty(); | 156 Property* AsProperty(); |
157 Variable* AsVariable(); | 157 Variable* AsVariable(); |
158 bool IsValidLeftHandSide() { return is_valid_LHS_; } | 158 bool IsValidLeftHandSide() { return is_valid_LHS_; } |
159 | 159 |
160 // The source code for an eval() call may refer to a variable that is | 160 // The source code for an eval() call may refer to a variable that is |
161 // in an outer scope about which we don't know anything (it may not | 161 // in an outer scope about which we don't know anything (it may not |
162 // be the global scope). scope() is NULL in that case. Currently the | 162 // be the global scope). scope() is NULL in that case. Currently the |
163 // scope is only used to follow the context chain length. | 163 // scope is only used to follow the context chain length. |
164 Scope* scope() const { return scope_; } | 164 Scope* scope() const { return scope_; } |
165 // If this assertion fails it means that some code has tried to | 165 |
166 // treat the special this variable as an ordinary variable with | |
167 // the name "this". | |
168 Handle<String> name() const { return name_; } | 166 Handle<String> name() const { return name_; } |
169 Mode mode() const { return mode_; } | 167 Mode mode() const { return mode_; } |
170 bool is_accessed_from_inner_scope() const { | 168 bool is_accessed_from_inner_scope() const { |
171 return is_accessed_from_inner_scope_; | 169 return is_accessed_from_inner_scope_; |
172 } | 170 } |
173 UseCount* var_uses() { return &var_uses_; } | 171 UseCount* var_uses() { return &var_uses_; } |
174 UseCount* obj_uses() { return &obj_uses_; } | 172 UseCount* obj_uses() { return &obj_uses_; } |
175 | 173 |
176 bool IsVariable(Handle<String> n) { | 174 bool IsVariable(Handle<String> n) { |
177 return !is_this() && name().is_identical_to(n); | 175 return !is_this() && name().is_identical_to(n); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // rewrite_ is usually a Slot or a Property, but may be any expression. | 220 // rewrite_ is usually a Slot or a Property, but may be any expression. |
223 Expression* rewrite_; | 221 Expression* rewrite_; |
224 | 222 |
225 friend class Scope; // Has explicit access to rewrite_. | 223 friend class Scope; // Has explicit access to rewrite_. |
226 }; | 224 }; |
227 | 225 |
228 | 226 |
229 } } // namespace v8::internal | 227 } } // namespace v8::internal |
230 | 228 |
231 #endif // V8_VARIABLES_H_ | 229 #endif // V8_VARIABLES_H_ |
OLD | NEW |