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/hashmap.h" | 9 #include "src/hashmap.h" |
10 #include "src/pending-compilation-error-handler.h" | 10 #include "src/pending-compilation-error-handler.h" |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 // function objects (i.e., the scope for which a function prologue allocates | 549 // function objects (i.e., the scope for which a function prologue allocates |
550 // a context) or declaring temporaries. | 550 // a context) or declaring temporaries. |
551 Scope* ClosureScope(); | 551 Scope* ClosureScope(); |
552 | 552 |
553 // Find the first (non-arrow) function or script scope. This is where | 553 // Find the first (non-arrow) function or script scope. This is where |
554 // 'this' is bound, and what determines the function kind. | 554 // 'this' is bound, and what determines the function kind. |
555 Scope* ReceiverScope(); | 555 Scope* ReceiverScope(); |
556 | 556 |
557 Handle<ScopeInfo> GetScopeInfo(Isolate* isolate); | 557 Handle<ScopeInfo> GetScopeInfo(Isolate* isolate); |
558 | 558 |
559 // Get the chain of nested scopes within this scope for the source statement | |
560 // position. The scopes will be added to the list from the outermost scope to | |
561 // the innermost scope. Only nested block, catch or with scopes are tracked | |
562 // and will be returned, but no inner function scopes. | |
563 void GetNestedScopeChain(Isolate* isolate, List<Handle<ScopeInfo> >* chain, | |
sergeyv
2016/02/25 20:45:55
I'm not sure if this is a good idea to move it to
Yang
2016/02/25 21:25:17
ExtendedScopeInfo sgtm.
| |
564 int statement_position); | |
565 | |
566 void CollectNonLocals(HashMap* non_locals); | 559 void CollectNonLocals(HashMap* non_locals); |
567 | 560 |
568 // --------------------------------------------------------------------------- | 561 // --------------------------------------------------------------------------- |
569 // Strict mode support. | 562 // Strict mode support. |
570 bool IsDeclared(const AstRawString* name) { | 563 bool IsDeclared(const AstRawString* name) { |
571 // During formal parameter list parsing the scope only contains | 564 // During formal parameter list parsing the scope only contains |
572 // two variables inserted at initialization: "this" and "arguments". | 565 // two variables inserted at initialization: "this" and "arguments". |
573 // "this" is an invalid parameter name and "arguments" is invalid parameter | 566 // "this" is an invalid parameter name and "arguments" is invalid parameter |
574 // name in strict mode. Therefore looking up with the map which includes | 567 // name in strict mode. Therefore looking up with the map which includes |
575 // "this" and "arguments" in addition to all formal parameters is safe. | 568 // "this" and "arguments" in addition to all formal parameters is safe. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
829 AstValueFactory* ast_value_factory_; | 822 AstValueFactory* ast_value_factory_; |
830 Zone* zone_; | 823 Zone* zone_; |
831 | 824 |
832 PendingCompilationErrorHandler pending_error_handler_; | 825 PendingCompilationErrorHandler pending_error_handler_; |
833 }; | 826 }; |
834 | 827 |
835 } // namespace internal | 828 } // namespace internal |
836 } // namespace v8 | 829 } // namespace v8 |
837 | 830 |
838 #endif // V8_AST_SCOPES_H_ | 831 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |