OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_PARSER_H_ | 5 #ifndef VM_PARSER_H_ |
6 #define VM_PARSER_H_ | 6 #define VM_PARSER_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 } | 338 } |
339 void ConsumeRightAngleBracket(); | 339 void ConsumeRightAngleBracket(); |
340 void CheckToken(Token::Kind token_expected, const char* msg = NULL); | 340 void CheckToken(Token::Kind token_expected, const char* msg = NULL); |
341 void ExpectToken(Token::Kind token_expected); | 341 void ExpectToken(Token::Kind token_expected); |
342 void ExpectSemicolon(); | 342 void ExpectSemicolon(); |
343 void UnexpectedToken(); | 343 void UnexpectedToken(); |
344 String* ExpectUserDefinedTypeIdentifier(const char* msg); | 344 String* ExpectUserDefinedTypeIdentifier(const char* msg); |
345 String* ExpectIdentifier(const char* msg); | 345 String* ExpectIdentifier(const char* msg); |
346 bool IsLiteral(const char* literal); | 346 bool IsLiteral(const char* literal); |
347 bool IsAwaitKeyword(); | 347 bool IsAwaitKeyword(); |
| 348 bool IsYieldKeyword(); |
348 | 349 |
349 void SkipIf(Token::Kind); | 350 void SkipIf(Token::Kind); |
350 void SkipBlock(); | 351 void SkipBlock(); |
351 intptr_t SkipMetadata(); | 352 intptr_t SkipMetadata(); |
352 void SkipToMatchingParenthesis(); | 353 void SkipToMatchingParenthesis(); |
353 void SkipTypeArguments(); | 354 void SkipTypeArguments(); |
354 void SkipType(bool allow_void); | 355 void SkipType(bool allow_void); |
355 void SkipInitializers(); | 356 void SkipInitializers(); |
356 void SkipExpr(); | 357 void SkipExpr(); |
357 void SkipNestedExpr(); | 358 void SkipNestedExpr(); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 void BuildDispatcherScope(const Function& func, | 552 void BuildDispatcherScope(const Function& func, |
552 const ArgumentsDescriptor& desc, | 553 const ArgumentsDescriptor& desc, |
553 Array* default_values); | 554 Array* default_values); |
554 | 555 |
555 void ChainNewBlock(LocalScope* outer_scope); | 556 void ChainNewBlock(LocalScope* outer_scope); |
556 void OpenBlock(); | 557 void OpenBlock(); |
557 void OpenLoopBlock(); | 558 void OpenLoopBlock(); |
558 void OpenFunctionBlock(const Function& func); | 559 void OpenFunctionBlock(const Function& func); |
559 void OpenAsyncClosure(); | 560 void OpenAsyncClosure(); |
560 RawFunction* OpenAsyncFunction(intptr_t formal_param_pos); | 561 RawFunction* OpenAsyncFunction(intptr_t formal_param_pos); |
| 562 RawFunction* OpenSyncGeneratorFunction(intptr_t func_pos); |
| 563 SequenceNode* CloseSyncGenFunction(const Function& closure, |
| 564 SequenceNode* closure_node); |
| 565 void AddSyncGenClosureParameters(ParamList* params); |
561 void OpenAsyncTryBlock(); | 566 void OpenAsyncTryBlock(); |
562 SequenceNode* CloseBlock(); | 567 SequenceNode* CloseBlock(); |
563 SequenceNode* CloseAsyncFunction(const Function& closure, | 568 SequenceNode* CloseAsyncFunction(const Function& closure, |
564 SequenceNode* closure_node); | 569 SequenceNode* closure_node); |
565 SequenceNode* CloseAsyncClosure(SequenceNode* body); | 570 SequenceNode* CloseAsyncClosure(SequenceNode* body); |
566 SequenceNode* CloseAsyncTryBlock(SequenceNode* try_block); | 571 SequenceNode* CloseAsyncTryBlock(SequenceNode* try_block); |
| 572 void AddAsyncClosureParameters(ParamList* params); |
| 573 void AddContinuationVariables(); |
567 void AddAsyncClosureVariables(); | 574 void AddAsyncClosureVariables(); |
568 | 575 |
569 | 576 |
570 LocalVariable* LookupPhaseParameter(); | 577 LocalVariable* LookupPhaseParameter(); |
571 LocalVariable* LookupReceiver(LocalScope* from_scope, bool test_only); | 578 LocalVariable* LookupReceiver(LocalScope* from_scope, bool test_only); |
572 LocalVariable* LookupTypeArgumentsParameter(LocalScope* from_scope, | 579 LocalVariable* LookupTypeArgumentsParameter(LocalScope* from_scope, |
573 bool test_only); | 580 bool test_only); |
574 void CaptureInstantiator(); | 581 void CaptureInstantiator(); |
575 AstNode* LoadReceiver(intptr_t token_pos); | 582 AstNode* LoadReceiver(intptr_t token_pos); |
576 AstNode* LoadFieldIfUnresolved(AstNode* node); | 583 AstNode* LoadFieldIfUnresolved(AstNode* node); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 Script& script_; | 786 Script& script_; |
780 TokenStream::Iterator tokens_iterator_; | 787 TokenStream::Iterator tokens_iterator_; |
781 Token::Kind token_kind_; // Cached token kind for current token. | 788 Token::Kind token_kind_; // Cached token kind for current token. |
782 Block* current_block_; | 789 Block* current_block_; |
783 | 790 |
784 // is_top_level_ is true if parsing the "top level" of a compilation unit, | 791 // is_top_level_ is true if parsing the "top level" of a compilation unit, |
785 // that is class definitions, function type aliases, global functions, | 792 // that is class definitions, function type aliases, global functions, |
786 // global variables. | 793 // global variables. |
787 bool is_top_level_; | 794 bool is_top_level_; |
788 | 795 |
789 // await_is_keyword_ is true if we are parsing an async function. In this | 796 // await_is_keyword_ is true if we are parsing an async or generator |
790 // context async is not treated as identifier but as a keyword. | 797 // function. In this context the identifiers await, async and yield |
| 798 // are treated as keywords. |
791 bool await_is_keyword_; | 799 bool await_is_keyword_; |
792 | 800 |
793 // The member currently being parsed during "top level" parsing. | 801 // The member currently being parsed during "top level" parsing. |
794 MemberDesc* current_member_; | 802 MemberDesc* current_member_; |
795 | 803 |
796 // Parser mode to allow/disallow function literals. This is used in | 804 // Parser mode to allow/disallow function literals. This is used in |
797 // constructor initializer expressions to handle ambiguous grammar. | 805 // constructor initializer expressions to handle ambiguous grammar. |
798 bool SetAllowFunctionLiterals(bool value); | 806 bool SetAllowFunctionLiterals(bool value); |
799 bool allow_function_literals_; | 807 bool allow_function_literals_; |
800 | 808 |
(...skipping 29 matching lines...) Expand all Loading... |
830 bool unregister_pending_function_; | 838 bool unregister_pending_function_; |
831 | 839 |
832 LocalScope* async_temp_scope_; | 840 LocalScope* async_temp_scope_; |
833 | 841 |
834 DISALLOW_COPY_AND_ASSIGN(Parser); | 842 DISALLOW_COPY_AND_ASSIGN(Parser); |
835 }; | 843 }; |
836 | 844 |
837 } // namespace dart | 845 } // namespace dart |
838 | 846 |
839 #endif // VM_PARSER_H_ | 847 #endif // VM_PARSER_H_ |
OLD | NEW |