| 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 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 | 7 |
| 8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 DEFINE_FLAG(bool, warn_patch, false, "Warn on old-style patch syntax."); | 63 DEFINE_FLAG(bool, warn_patch, false, "Warn on old-style patch syntax."); |
| 64 DEFINE_FLAG( | 64 DEFINE_FLAG( |
| 65 bool, | 65 bool, |
| 66 await_is_keyword, | 66 await_is_keyword, |
| 67 false, | 67 false, |
| 68 "await and yield are treated as proper keywords in synchronous code."); | 68 "await and yield are treated as proper keywords in synchronous code."); |
| 69 DEFINE_FLAG(bool, | 69 DEFINE_FLAG(bool, |
| 70 assert_initializer, | 70 assert_initializer, |
| 71 false, | 71 false, |
| 72 "Allow asserts in initializer lists."); | 72 "Allow asserts in initializer lists."); |
| 73 DEFINE_FLAG(bool, assert_message, false, "Allow message in assert statements"); | |
| 74 | 73 |
| 75 DECLARE_FLAG(bool, profile_vm); | 74 DECLARE_FLAG(bool, profile_vm); |
| 76 DECLARE_FLAG(bool, trace_service); | 75 DECLARE_FLAG(bool, trace_service); |
| 77 DECLARE_FLAG(bool, ignore_patch_signature_mismatch); | 76 DECLARE_FLAG(bool, ignore_patch_signature_mismatch); |
| 78 | 77 |
| 79 // Quick access to the current thread, isolate and zone. | 78 // Quick access to the current thread, isolate and zone. |
| 80 #define T (thread()) | 79 #define T (thread()) |
| 81 #define I (isolate()) | 80 #define I (isolate()) |
| 82 #define Z (zone()) | 81 #define Z (zone()) |
| 83 | 82 |
| (...skipping 9074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9158 } | 9157 } |
| 9159 | 9158 |
| 9160 | 9159 |
| 9161 AstNode* Parser::ParseAssertStatement(bool is_const) { | 9160 AstNode* Parser::ParseAssertStatement(bool is_const) { |
| 9162 TRACE_PARSER("ParseAssertStatement"); | 9161 TRACE_PARSER("ParseAssertStatement"); |
| 9163 ConsumeToken(); // Consume assert keyword. | 9162 ConsumeToken(); // Consume assert keyword. |
| 9164 ExpectToken(Token::kLPAREN); | 9163 ExpectToken(Token::kLPAREN); |
| 9165 const TokenPosition condition_pos = TokenPos(); | 9164 const TokenPosition condition_pos = TokenPos(); |
| 9166 if (!I->asserts()) { | 9165 if (!I->asserts()) { |
| 9167 SkipExpr(); | 9166 SkipExpr(); |
| 9168 if (FLAG_assert_message && (CurrentToken() == Token::kCOMMA)) { | 9167 if (CurrentToken() == Token::kCOMMA) { |
| 9169 ConsumeToken(); | 9168 ConsumeToken(); |
| 9170 SkipExpr(); | 9169 SkipExpr(); |
| 9171 } | 9170 } |
| 9172 ExpectToken(Token::kRPAREN); | 9171 ExpectToken(Token::kRPAREN); |
| 9173 return NULL; | 9172 return NULL; |
| 9174 } | 9173 } |
| 9175 | 9174 |
| 9176 BoolScope saved_seen_await(&parsed_function()->have_seen_await_expr_, false); | 9175 BoolScope saved_seen_await(&parsed_function()->have_seen_await_expr_, false); |
| 9177 AstNode* condition = ParseExpr(kAllowConst, kConsumeCascades); | 9176 AstNode* condition = ParseExpr(kAllowConst, kConsumeCascades); |
| 9178 if (is_const && !condition->IsPotentiallyConst()) { | 9177 if (is_const && !condition->IsPotentiallyConst()) { |
| 9179 ReportError(condition_pos, | 9178 ReportError(condition_pos, |
| 9180 "initializer assert expression must be compile time constant."); | 9179 "initializer assert expression must be compile time constant."); |
| 9181 } | 9180 } |
| 9182 const TokenPosition condition_end = TokenPos(); | 9181 const TokenPosition condition_end = TokenPos(); |
| 9183 AstNode* message = NULL; | 9182 AstNode* message = NULL; |
| 9184 TokenPosition message_pos = TokenPosition::kNoSource; | 9183 TokenPosition message_pos = TokenPosition::kNoSource; |
| 9185 if (FLAG_assert_message && CurrentToken() == Token::kCOMMA) { | 9184 if (CurrentToken() == Token::kCOMMA) { |
| 9186 ConsumeToken(); | 9185 ConsumeToken(); |
| 9187 message_pos = TokenPos(); | 9186 message_pos = TokenPos(); |
| 9188 message = ParseExpr(kAllowConst, kConsumeCascades); | 9187 message = ParseExpr(kAllowConst, kConsumeCascades); |
| 9189 if (is_const && !message->IsPotentiallyConst()) { | 9188 if (is_const && !message->IsPotentiallyConst()) { |
| 9190 ReportError( | 9189 ReportError( |
| 9191 message_pos, | 9190 message_pos, |
| 9192 "initializer assert expression must be compile time constant."); | 9191 "initializer assert expression must be compile time constant."); |
| 9193 } | 9192 } |
| 9194 } | 9193 } |
| 9195 ExpectToken(Token::kRPAREN); | 9194 ExpectToken(Token::kRPAREN); |
| (...skipping 5348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14544 const ArgumentListNode& function_args, | 14543 const ArgumentListNode& function_args, |
| 14545 const LocalVariable* temp_for_last_arg, | 14544 const LocalVariable* temp_for_last_arg, |
| 14546 bool is_super_invocation) { | 14545 bool is_super_invocation) { |
| 14547 UNREACHABLE(); | 14546 UNREACHABLE(); |
| 14548 return NULL; | 14547 return NULL; |
| 14549 } | 14548 } |
| 14550 | 14549 |
| 14551 } // namespace dart | 14550 } // namespace dart |
| 14552 | 14551 |
| 14553 #endif // DART_PRECOMPILED_RUNTIME | 14552 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |