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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // The scope name is only used for printing/debugging. | 81 // The scope name is only used for printing/debugging. |
82 void SetScopeName(Handle<String> scope_name) { scope_name_ = scope_name; } | 82 void SetScopeName(Handle<String> scope_name) { scope_name_ = scope_name; } |
83 | 83 |
84 void Initialize(bool inside_with); | 84 void Initialize(bool inside_with); |
85 | 85 |
86 | 86 |
87 // --------------------------------------------------------------------------- | 87 // --------------------------------------------------------------------------- |
88 // Declarations | 88 // Declarations |
89 | 89 |
90 // Lookup a variable in this scope. Returns the variable or NULL if not found. | 90 // Lookup a variable in this scope. Returns the variable or NULL if not found. |
| 91 virtual Variable* LookupLocal(Handle<String> name); |
| 92 |
| 93 // Lookup a variable in this scope or outer scopes. |
| 94 // Returns the variable or NULL if not found. |
91 virtual Variable* Lookup(Handle<String> name); | 95 virtual Variable* Lookup(Handle<String> name); |
92 | 96 |
93 // Declare the function variable for a function literal. This variable | 97 // Declare the function variable for a function literal. This variable |
94 // is in an intermediate scope between this function scope and the the | 98 // is in an intermediate scope between this function scope and the the |
95 // outer scope. Only possible for function scopes; at most one variable. | 99 // outer scope. Only possible for function scopes; at most one variable. |
96 Variable* DeclareFunctionVar(Handle<String> name); | 100 Variable* DeclareFunctionVar(Handle<String> name); |
97 | 101 |
98 // Declare a variable in this scope. If the variable has been | 102 // Declare a variable in this scope. If the variable has been |
99 // declared before, the previously declared variable is returned. | 103 // declared before, the previously declared variable is returned. |
100 virtual Variable* Declare(Handle<String> name, Variable::Mode mode); | 104 virtual Variable* Declare(Handle<String> name, Variable::Mode mode); |
(...skipping 30 matching lines...) Expand all Loading... |
131 // Illegal redeclaration support. | 135 // Illegal redeclaration support. |
132 | 136 |
133 // Set an expression node that will be executed when the scope is | 137 // Set an expression node that will be executed when the scope is |
134 // entered. We only keep track of one illegal redeclaration node per | 138 // entered. We only keep track of one illegal redeclaration node per |
135 // scope - the first one - so if you try to set it multiple times | 139 // scope - the first one - so if you try to set it multiple times |
136 // the additional requests will be silently ignored. | 140 // the additional requests will be silently ignored. |
137 void SetIllegalRedeclaration(Expression* expression); | 141 void SetIllegalRedeclaration(Expression* expression); |
138 | 142 |
139 // Visit the illegal redeclaration expression. Do not call if the | 143 // Visit the illegal redeclaration expression. Do not call if the |
140 // scope doesn't have an illegal redeclaration node. | 144 // scope doesn't have an illegal redeclaration node. |
141 void VisitIllegalRedeclaration(Visitor* visitor); | 145 void VisitIllegalRedeclaration(AstVisitor* visitor); |
142 | 146 |
143 // Check if the scope has (at least) one illegal redeclaration. | 147 // Check if the scope has (at least) one illegal redeclaration. |
144 bool HasIllegalRedeclaration() const { return illegal_redecl_ != NULL; } | 148 bool HasIllegalRedeclaration() const { return illegal_redecl_ != NULL; } |
145 | 149 |
146 | 150 |
147 // --------------------------------------------------------------------------- | 151 // --------------------------------------------------------------------------- |
148 // Scope-specific info. | 152 // Scope-specific info. |
149 | 153 |
150 // Inform the scope that the corresponding code contains a with statement. | 154 // Inform the scope that the corresponding code contains a with statement. |
151 void RecordWithStatement() { scope_contains_with_ = true; } | 155 void RecordWithStatement() { scope_contains_with_ = true; } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 virtual VariableProxy* NewUnresolved(Handle<String> name, bool inside_with) { | 341 virtual VariableProxy* NewUnresolved(Handle<String> name, bool inside_with) { |
338 return NULL; | 342 return NULL; |
339 } | 343 } |
340 virtual VariableProxy* NewTemporary(Handle<String> name) { return NULL; } | 344 virtual VariableProxy* NewTemporary(Handle<String> name) { return NULL; } |
341 }; | 345 }; |
342 | 346 |
343 | 347 |
344 } } // namespace v8::internal | 348 } } // namespace v8::internal |
345 | 349 |
346 #endif // V8_SCOPES_H_ | 350 #endif // V8_SCOPES_H_ |
OLD | NEW |