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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 bool inside_with() const { return scope_inside_with_; } | 199 bool inside_with() const { return scope_inside_with_; } |
200 // Does this scope contain a with statement. | 200 // Does this scope contain a with statement. |
201 bool contains_with() const { return scope_contains_with_; } | 201 bool contains_with() const { return scope_contains_with_; } |
202 | 202 |
203 // The scope immediately surrounding this scope, or NULL. | 203 // The scope immediately surrounding this scope, or NULL. |
204 Scope* outer_scope() const { return outer_scope_; } | 204 Scope* outer_scope() const { return outer_scope_; } |
205 | 205 |
206 // --------------------------------------------------------------------------- | 206 // --------------------------------------------------------------------------- |
207 // Accessors. | 207 // Accessors. |
208 | 208 |
209 // The variable corresponding to the (function) receiver. | 209 // A new variable proxy corresponding to the (function) receiver. |
210 VariableProxy* receiver() const { return receiver_; } | 210 VariableProxy* receiver() const { |
| 211 VariableProxy* proxy = |
| 212 new VariableProxy(Factory::this_symbol(), true, false); |
| 213 proxy->BindTo(receiver_); |
| 214 return proxy; |
| 215 } |
211 | 216 |
212 // The variable holding the function literal for named function | 217 // The variable holding the function literal for named function |
213 // literals, or NULL. | 218 // literals, or NULL. |
214 // Only valid for function scopes. | 219 // Only valid for function scopes. |
215 Variable* function() const { | 220 Variable* function() const { |
216 ASSERT(is_function_scope()); | 221 ASSERT(is_function_scope()); |
217 return function_; | 222 return function_; |
218 } | 223 } |
219 | 224 |
220 // Parameters. The left-most parameter has index 0. | 225 // Parameters. The left-most parameter has index 0. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 ZoneList<Variable*> temps_; | 312 ZoneList<Variable*> temps_; |
308 // Parameter list in source order. | 313 // Parameter list in source order. |
309 ZoneList<Variable*> params_; | 314 ZoneList<Variable*> params_; |
310 // Variables that must be looked up dynamically. | 315 // Variables that must be looked up dynamically. |
311 DynamicScopePart* dynamics_; | 316 DynamicScopePart* dynamics_; |
312 // Unresolved variables referred to from this scope. | 317 // Unresolved variables referred to from this scope. |
313 ZoneList<VariableProxy*> unresolved_; | 318 ZoneList<VariableProxy*> unresolved_; |
314 // Declarations. | 319 // Declarations. |
315 ZoneList<Declaration*> decls_; | 320 ZoneList<Declaration*> decls_; |
316 // Convenience variable. | 321 // Convenience variable. |
317 VariableProxy* receiver_; | 322 Variable* receiver_; |
318 // Function variable, if any; function scopes only. | 323 // Function variable, if any; function scopes only. |
319 Variable* function_; | 324 Variable* function_; |
320 // Convenience variable; function scopes only. | 325 // Convenience variable; function scopes only. |
321 VariableProxy* arguments_; | 326 VariableProxy* arguments_; |
322 // Convenience variable; function scopes only. | 327 // Convenience variable; function scopes only. |
323 VariableProxy* arguments_shadow_; | 328 VariableProxy* arguments_shadow_; |
324 | 329 |
325 // Illegal redeclaration. | 330 // Illegal redeclaration. |
326 Expression* illegal_redecl_; | 331 Expression* illegal_redecl_; |
327 | 332 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 virtual VariableProxy* NewUnresolved(Handle<String> name, bool inside_with) { | 392 virtual VariableProxy* NewUnresolved(Handle<String> name, bool inside_with) { |
388 return NULL; | 393 return NULL; |
389 } | 394 } |
390 virtual VariableProxy* NewTemporary(Handle<String> name) { return NULL; } | 395 virtual VariableProxy* NewTemporary(Handle<String> name) { return NULL; } |
391 }; | 396 }; |
392 | 397 |
393 | 398 |
394 } } // namespace v8::internal | 399 } } // namespace v8::internal |
395 | 400 |
396 #endif // V8_SCOPES_H_ | 401 #endif // V8_SCOPES_H_ |
OLD | NEW |