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 #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 9073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9084 } | 9084 } |
9085 return condition; | 9085 return condition; |
9086 } | 9086 } |
9087 | 9087 |
9088 | 9088 |
9089 AstNode* Parser::ParseAssertStatement() { | 9089 AstNode* Parser::ParseAssertStatement() { |
9090 TRACE_PARSER("ParseAssertStatement"); | 9090 TRACE_PARSER("ParseAssertStatement"); |
9091 ConsumeToken(); // Consume assert keyword. | 9091 ConsumeToken(); // Consume assert keyword. |
9092 ExpectToken(Token::kLPAREN); | 9092 ExpectToken(Token::kLPAREN); |
9093 const intptr_t condition_pos = TokenPos(); | 9093 const intptr_t condition_pos = TokenPos(); |
9094 if (!I->flags().asserts()) { | 9094 if (!I->flags().asserts() && !I->flags().type_checks()) { |
9095 SkipExpr(); | 9095 SkipExpr(); |
9096 ExpectToken(Token::kRPAREN); | 9096 ExpectToken(Token::kRPAREN); |
9097 return NULL; | 9097 return NULL; |
9098 } | 9098 } |
9099 AstNode* condition = ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL); | 9099 AstNode* condition = ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL); |
9100 const intptr_t condition_end = TokenPos(); | 9100 const intptr_t condition_end = TokenPos(); |
9101 ExpectToken(Token::kRPAREN); | 9101 ExpectToken(Token::kRPAREN); |
9102 condition = InsertClosureCallNodes(condition); | 9102 condition = InsertClosureCallNodes(condition); |
9103 condition = new(Z) UnaryOpNode(condition_pos, Token::kNOT, condition); | 9103 condition = new(Z) UnaryOpNode(condition_pos, Token::kNOT, condition); |
9104 AstNode* assert_throw = MakeAssertCall(condition_pos, condition_end); | 9104 AstNode* assert_throw = MakeAssertCall(condition_pos, condition_end); |
(...skipping 5177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14282 void Parser::SkipQualIdent() { | 14282 void Parser::SkipQualIdent() { |
14283 ASSERT(IsIdentifier()); | 14283 ASSERT(IsIdentifier()); |
14284 ConsumeToken(); | 14284 ConsumeToken(); |
14285 if (CurrentToken() == Token::kPERIOD) { | 14285 if (CurrentToken() == Token::kPERIOD) { |
14286 ConsumeToken(); // Consume the kPERIOD token. | 14286 ConsumeToken(); // Consume the kPERIOD token. |
14287 ExpectIdentifier("identifier expected after '.'"); | 14287 ExpectIdentifier("identifier expected after '.'"); |
14288 } | 14288 } |
14289 } | 14289 } |
14290 | 14290 |
14291 } // namespace dart | 14291 } // namespace dart |
OLD | NEW |