| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // Lookup a variable in this scope. Returns the variable or NULL if not found. | 118 // Lookup a variable in this scope. Returns the variable or NULL if not found. |
| 119 Variable* LocalLookup(Handle<String> name); | 119 Variable* LocalLookup(Handle<String> name); |
| 120 | 120 |
| 121 // Lookup a variable in this scope or outer scopes. | 121 // Lookup a variable in this scope or outer scopes. |
| 122 // Returns the variable or NULL if not found. | 122 // Returns the variable or NULL if not found. |
| 123 Variable* Lookup(Handle<String> name); | 123 Variable* Lookup(Handle<String> name); |
| 124 | 124 |
| 125 // Declare the function variable for a function literal. This variable | 125 // Declare the function variable for a function literal. This variable |
| 126 // is in an intermediate scope between this function scope and the the | 126 // is in an intermediate scope between this function scope and the the |
| 127 // outer scope. Only possible for function scopes; at most one variable. | 127 // outer scope. Only possible for function scopes; at most one variable. |
| 128 Variable* DeclareFunctionVar(Handle<String> name); | 128 VariableProxy* DeclareFunctionVar(Handle<String> name); |
| 129 | 129 |
| 130 // Declare a parameter in this scope. When there are duplicated | 130 // Declare a parameter in this scope. When there are duplicated |
| 131 // parameters the rightmost one 'wins'. However, the implementation | 131 // parameters the rightmost one 'wins'. However, the implementation |
| 132 // expects all parameters to be declared and from left to right. | 132 // expects all parameters to be declared and from left to right. |
| 133 void DeclareParameter(Handle<String> name, Variable::Mode mode); | 133 void DeclareParameter(Handle<String> name, Variable::Mode mode); |
| 134 | 134 |
| 135 // Declare a local variable in this scope. If the variable has been | 135 // Declare a local variable in this scope. If the variable has been |
| 136 // declared before, the previously declared variable is returned. | 136 // declared before, the previously declared variable is returned. |
| 137 Variable* DeclareLocal(Handle<String> name, Variable::Mode mode); | 137 Variable* DeclareLocal(Handle<String> name, Variable::Mode mode); |
| 138 | 138 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 // --------------------------------------------------------------------------- | 233 // --------------------------------------------------------------------------- |
| 234 // Accessors. | 234 // Accessors. |
| 235 | 235 |
| 236 // The variable corresponding the 'this' value. | 236 // The variable corresponding the 'this' value. |
| 237 Variable* receiver() { return receiver_; } | 237 Variable* receiver() { return receiver_; } |
| 238 | 238 |
| 239 // The variable holding the function literal for named function | 239 // The variable holding the function literal for named function |
| 240 // literals, or NULL. | 240 // literals, or NULL. |
| 241 // Only valid for function scopes. | 241 // Only valid for function scopes. |
| 242 Variable* function() const { | 242 VariableProxy* function() const { |
| 243 ASSERT(is_function_scope()); | 243 ASSERT(is_function_scope()); |
| 244 return function_; | 244 return function_; |
| 245 } | 245 } |
| 246 | 246 |
| 247 // Parameters. The left-most parameter has index 0. | 247 // Parameters. The left-most parameter has index 0. |
| 248 // Only valid for function scopes. | 248 // Only valid for function scopes. |
| 249 Variable* parameter(int index) const { | 249 Variable* parameter(int index) const { |
| 250 ASSERT(is_function_scope()); | 250 ASSERT(is_function_scope()); |
| 251 return params_[index]; | 251 return params_[index]; |
| 252 } | 252 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 ZoneList<Variable*> params_; | 351 ZoneList<Variable*> params_; |
| 352 // Variables that must be looked up dynamically. | 352 // Variables that must be looked up dynamically. |
| 353 DynamicScopePart* dynamics_; | 353 DynamicScopePart* dynamics_; |
| 354 // Unresolved variables referred to from this scope. | 354 // Unresolved variables referred to from this scope. |
| 355 ZoneList<VariableProxy*> unresolved_; | 355 ZoneList<VariableProxy*> unresolved_; |
| 356 // Declarations. | 356 // Declarations. |
| 357 ZoneList<Declaration*> decls_; | 357 ZoneList<Declaration*> decls_; |
| 358 // Convenience variable. | 358 // Convenience variable. |
| 359 Variable* receiver_; | 359 Variable* receiver_; |
| 360 // Function variable, if any; function scopes only. | 360 // Function variable, if any; function scopes only. |
| 361 Variable* function_; | 361 VariableProxy* function_; |
| 362 // Convenience variable; function scopes only. | 362 // Convenience variable; function scopes only. |
| 363 Variable* arguments_; | 363 Variable* arguments_; |
| 364 | 364 |
| 365 // Illegal redeclaration. | 365 // Illegal redeclaration. |
| 366 Expression* illegal_redecl_; | 366 Expression* illegal_redecl_; |
| 367 | 367 |
| 368 // Scope-specific information computed during parsing. | 368 // Scope-specific information computed during parsing. |
| 369 // | 369 // |
| 370 // This scope is inside a 'with' of some outer scope. | 370 // This scope is inside a 'with' of some outer scope. |
| 371 bool scope_inside_with_; | 371 bool scope_inside_with_; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 } | 451 } |
| 452 | 452 |
| 453 void SetDefaults(Type type, | 453 void SetDefaults(Type type, |
| 454 Scope* outer_scope, | 454 Scope* outer_scope, |
| 455 Handle<SerializedScopeInfo> scope_info); | 455 Handle<SerializedScopeInfo> scope_info); |
| 456 }; | 456 }; |
| 457 | 457 |
| 458 } } // namespace v8::internal | 458 } } // namespace v8::internal |
| 459 | 459 |
| 460 #endif // V8_SCOPES_H_ | 460 #endif // V8_SCOPES_H_ |
| OLD | NEW |