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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Variable* 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); | 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 |
139 // Declare an implicit global variable in this scope which must be a | 139 // Declare an implicit global variable in this scope which must be a |
140 // global scope. The variable was introduced (possibly from an inner | 140 // global scope. The variable was introduced (possibly from an inner |
141 // scope) by a reference to an unresolved variable with no intervening | 141 // scope) by a reference to an unresolved variable with no intervening |
142 // with statements or eval calls. | 142 // with statements or eval calls. |
143 Variable* DeclareGlobal(Handle<String> name); | 143 Variable* DeclareGlobal(Handle<String> name); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // the additional requests will be silently ignored. | 175 // the additional requests will be silently ignored. |
176 void SetIllegalRedeclaration(Expression* expression); | 176 void SetIllegalRedeclaration(Expression* expression); |
177 | 177 |
178 // Visit the illegal redeclaration expression. Do not call if the | 178 // Visit the illegal redeclaration expression. Do not call if the |
179 // scope doesn't have an illegal redeclaration node. | 179 // scope doesn't have an illegal redeclaration node. |
180 void VisitIllegalRedeclaration(AstVisitor* visitor); | 180 void VisitIllegalRedeclaration(AstVisitor* visitor); |
181 | 181 |
182 // Check if the scope has (at least) one illegal redeclaration. | 182 // Check if the scope has (at least) one illegal redeclaration. |
183 bool HasIllegalRedeclaration() const { return illegal_redecl_ != NULL; } | 183 bool HasIllegalRedeclaration() const { return illegal_redecl_ != NULL; } |
184 | 184 |
| 185 // For harmony block scoping mode: Check if the scope has conflicting var |
| 186 // declarations, i.e. a var declaration that has been hoisted from a nested |
| 187 // scope over a let binding of the same name. |
| 188 Declaration* CheckConflictingVarDeclarations(); |
185 | 189 |
186 // --------------------------------------------------------------------------- | 190 // --------------------------------------------------------------------------- |
187 // Scope-specific info. | 191 // Scope-specific info. |
188 | 192 |
189 // Inform the scope that the corresponding code contains a with statement. | 193 // Inform the scope that the corresponding code contains a with statement. |
190 void RecordWithStatement() { scope_contains_with_ = true; } | 194 void RecordWithStatement() { scope_contains_with_ = true; } |
191 | 195 |
192 // Inform the scope that the corresponding code contains an eval call. | 196 // Inform the scope that the corresponding code contains an eval call. |
193 void RecordEvalCall() { scope_calls_eval_ = true; } | 197 void RecordEvalCall() { scope_calls_eval_ = true; } |
194 | 198 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 } | 451 } |
448 | 452 |
449 void SetDefaults(Type type, | 453 void SetDefaults(Type type, |
450 Scope* outer_scope, | 454 Scope* outer_scope, |
451 Handle<SerializedScopeInfo> scope_info); | 455 Handle<SerializedScopeInfo> scope_info); |
452 }; | 456 }; |
453 | 457 |
454 } } // namespace v8::internal | 458 } } // namespace v8::internal |
455 | 459 |
456 #endif // V8_SCOPES_H_ | 460 #endif // V8_SCOPES_H_ |
OLD | NEW |