Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: runtime/vm/parser.cc

Issue 991373003: Allow await in assert (fix issue 22728). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/regress_22728_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/ast_transformer.h" 9 #include "vm/ast_transformer.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 8614 matching lines...) Expand 10 before | Expand all | Expand 10 after
8625 AstNode* Parser::ParseAssertStatement() { 8625 AstNode* Parser::ParseAssertStatement() {
8626 TRACE_PARSER("ParseAssertStatement"); 8626 TRACE_PARSER("ParseAssertStatement");
8627 ConsumeToken(); // Consume assert keyword. 8627 ConsumeToken(); // Consume assert keyword.
8628 ExpectToken(Token::kLPAREN); 8628 ExpectToken(Token::kLPAREN);
8629 const intptr_t condition_pos = TokenPos(); 8629 const intptr_t condition_pos = TokenPos();
8630 if (!I->AssertsEnabled() && !I->TypeChecksEnabled()) { 8630 if (!I->AssertsEnabled() && !I->TypeChecksEnabled()) {
8631 SkipExpr(); 8631 SkipExpr();
8632 ExpectToken(Token::kRPAREN); 8632 ExpectToken(Token::kRPAREN);
8633 return NULL; 8633 return NULL;
8634 } 8634 }
8635 AstNode* condition = ParseExpr(kAllowConst, kConsumeCascades); 8635 AstNode* condition = ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL);
8636 const intptr_t condition_end = TokenPos(); 8636 const intptr_t condition_end = TokenPos();
8637 ExpectToken(Token::kRPAREN); 8637 ExpectToken(Token::kRPAREN);
8638 condition = InsertClosureCallNodes(condition); 8638 condition = InsertClosureCallNodes(condition);
8639 condition = new(Z) UnaryOpNode(condition_pos, Token::kNOT, condition); 8639 condition = new(Z) UnaryOpNode(condition_pos, Token::kNOT, condition);
8640 AstNode* assert_throw = MakeAssertCall(condition_pos, condition_end); 8640 AstNode* assert_throw = MakeAssertCall(condition_pos, condition_end);
8641 return new(Z) IfNode( 8641 return new(Z) IfNode(
8642 condition_pos, 8642 condition_pos,
8643 condition, 8643 condition,
8644 NodeAsSequenceNode(condition_pos, assert_throw, NULL), 8644 NodeAsSequenceNode(condition_pos, assert_throw, NULL),
8645 NULL); 8645 NULL);
(...skipping 4568 matching lines...) Expand 10 before | Expand all | Expand 10 after
13214 void Parser::SkipQualIdent() { 13214 void Parser::SkipQualIdent() {
13215 ASSERT(IsIdentifier()); 13215 ASSERT(IsIdentifier());
13216 ConsumeToken(); 13216 ConsumeToken();
13217 if (CurrentToken() == Token::kPERIOD) { 13217 if (CurrentToken() == Token::kPERIOD) {
13218 ConsumeToken(); // Consume the kPERIOD token. 13218 ConsumeToken(); // Consume the kPERIOD token.
13219 ExpectIdentifier("identifier expected after '.'"); 13219 ExpectIdentifier("identifier expected after '.'");
13220 } 13220 }
13221 } 13221 }
13222 13222
13223 } // namespace dart 13223 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/regress_22728_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698