OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_AST_SCOPES_H_ | 5 #ifndef V8_AST_SCOPES_H_ |
6 #define V8_AST_SCOPES_H_ | 6 #define V8_AST_SCOPES_H_ |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 // During formal parameter list parsing the scope only contains | 420 // During formal parameter list parsing the scope only contains |
421 // two variables inserted at initialization: "this" and "arguments". | 421 // two variables inserted at initialization: "this" and "arguments". |
422 // "this" is an invalid parameter name and "arguments" is invalid parameter | 422 // "this" is an invalid parameter name and "arguments" is invalid parameter |
423 // name in strict mode. Therefore looking up with the map which includes | 423 // name in strict mode. Therefore looking up with the map which includes |
424 // "this" and "arguments" in addition to all formal parameters is safe. | 424 // "this" and "arguments" in addition to all formal parameters is safe. |
425 return variables_.Lookup(name) != NULL; | 425 return variables_.Lookup(name) != NULL; |
426 } | 426 } |
427 | 427 |
428 int num_var() const { return variables_.occupancy(); } | 428 int num_var() const { return variables_.occupancy(); } |
429 | 429 |
430 // GetScopeInfo() must have been called once to create the ScopeInfo. | |
431 Handle<ScopeInfo> scope_info() { | |
Michael Starzinger
2016/08/16 09:10:21
nit: Can we move this to below the declration of "
rmcilroy
2016/08/16 11:24:54
Done.
| |
432 DCHECK(!scope_info_.is_null()); | |
433 return scope_info_; | |
434 } | |
435 | |
430 // --------------------------------------------------------------------------- | 436 // --------------------------------------------------------------------------- |
431 // Debugging. | 437 // Debugging. |
432 | 438 |
433 #ifdef DEBUG | 439 #ifdef DEBUG |
434 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively | 440 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively |
435 | 441 |
436 // Check that the scope has positions assigned. | 442 // Check that the scope has positions assigned. |
437 void CheckScopePositions(); | 443 void CheckScopePositions(); |
438 | 444 |
439 // Check that all Scopes in the scope tree use the same Zone. | 445 // Check that all Scopes in the scope tree use the same Zone. |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
884 // Convenience variable; Subclass constructor only | 890 // Convenience variable; Subclass constructor only |
885 Variable* this_function_; | 891 Variable* this_function_; |
886 // Module descriptor; module scopes only. | 892 // Module descriptor; module scopes only. |
887 ModuleDescriptor* module_descriptor_; | 893 ModuleDescriptor* module_descriptor_; |
888 }; | 894 }; |
889 | 895 |
890 } // namespace internal | 896 } // namespace internal |
891 } // namespace v8 | 897 } // namespace v8 |
892 | 898 |
893 #endif // V8_AST_SCOPES_H_ | 899 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |