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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 283 |
284 // Determine if we can use lazy compilation for this scope. | 284 // Determine if we can use lazy compilation for this scope. |
285 bool AllowsLazyCompilation() const; | 285 bool AllowsLazyCompilation() const; |
286 | 286 |
287 // True if the outer context of this scope is always the global context. | 287 // True if the outer context of this scope is always the global context. |
288 bool HasTrivialOuterContext() const; | 288 bool HasTrivialOuterContext() const; |
289 | 289 |
290 // The number of contexts between this and scope; zero if this == scope. | 290 // The number of contexts between this and scope; zero if this == scope. |
291 int ContextChainLength(Scope* scope); | 291 int ContextChainLength(Scope* scope); |
292 | 292 |
| 293 // Find the first function, global, or eval scope. This is the scope |
| 294 // where var declarations will be hoisted to in the implementation. |
| 295 Scope* DeclarationScope(); |
| 296 |
293 // --------------------------------------------------------------------------- | 297 // --------------------------------------------------------------------------- |
294 // Strict mode support. | 298 // Strict mode support. |
295 bool IsDeclared(Handle<String> name) { | 299 bool IsDeclared(Handle<String> name) { |
296 // During formal parameter list parsing the scope only contains | 300 // During formal parameter list parsing the scope only contains |
297 // two variables inserted at initialization: "this" and "arguments". | 301 // two variables inserted at initialization: "this" and "arguments". |
298 // "this" is an invalid parameter name and "arguments" is invalid parameter | 302 // "this" is an invalid parameter name and "arguments" is invalid parameter |
299 // name in strict mode. Therefore looking up with the map which includes | 303 // name in strict mode. Therefore looking up with the map which includes |
300 // "this" and "arguments" in addition to all formal parameters is safe. | 304 // "this" and "arguments" in addition to all formal parameters is safe. |
301 return variables_.Lookup(name) != NULL; | 305 return variables_.Lookup(name) != NULL; |
302 } | 306 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } | 431 } |
428 | 432 |
429 void SetDefaults(Type type, | 433 void SetDefaults(Type type, |
430 Scope* outer_scope, | 434 Scope* outer_scope, |
431 Handle<SerializedScopeInfo> scope_info); | 435 Handle<SerializedScopeInfo> scope_info); |
432 }; | 436 }; |
433 | 437 |
434 } } // namespace v8::internal | 438 } } // namespace v8::internal |
435 | 439 |
436 #endif // V8_SCOPES_H_ | 440 #endif // V8_SCOPES_H_ |
OLD | NEW |