| 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 23 matching lines...) Expand all Loading... |
| 34 #include "vm/tags.h" | 34 #include "vm/tags.h" |
| 35 #include "vm/timer.h" | 35 #include "vm/timer.h" |
| 36 #include "vm/zone.h" | 36 #include "vm/zone.h" |
| 37 | 37 |
| 38 namespace dart { | 38 namespace dart { |
| 39 | 39 |
| 40 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); | 40 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); |
| 41 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); | 41 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); |
| 42 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); | 42 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); |
| 43 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); | 43 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); |
| 44 DEFINE_FLAG(bool, enable_async, true, "Enable async operations."); | |
| 45 DECLARE_FLAG(bool, error_on_bad_type); | 44 DECLARE_FLAG(bool, error_on_bad_type); |
| 46 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 45 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
| 47 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | 46 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
| 48 | 47 |
| 49 static void CheckedModeHandler(bool value) { | 48 static void CheckedModeHandler(bool value) { |
| 50 FLAG_enable_asserts = value; | 49 FLAG_enable_asserts = value; |
| 51 FLAG_enable_type_checks = value; | 50 FLAG_enable_type_checks = value; |
| 52 } | 51 } |
| 53 | 52 |
| 54 // --enable-checked-mode and --checked both enable checked mode which is | 53 // --enable-checked-mode and --checked both enable checked mode which is |
| (...skipping 5122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5177 break; | 5176 break; |
| 5178 } else { | 5177 } else { |
| 5179 ExpectSemicolon(); // Reports error. | 5178 ExpectSemicolon(); // Reports error. |
| 5180 } | 5179 } |
| 5181 } | 5180 } |
| 5182 } | 5181 } |
| 5183 | 5182 |
| 5184 | 5183 |
| 5185 RawFunction::AsyncModifier Parser::ParseFunctionModifier() { | 5184 RawFunction::AsyncModifier Parser::ParseFunctionModifier() { |
| 5186 if (CurrentLiteral()->raw() == Symbols::Async().raw()) { | 5185 if (CurrentLiteral()->raw() == Symbols::Async().raw()) { |
| 5187 if (!FLAG_enable_async) { | |
| 5188 ReportError("use flag --enable-async to enable async/await features"); | |
| 5189 } | |
| 5190 ConsumeToken(); | 5186 ConsumeToken(); |
| 5191 return RawFunction::kAsync; | 5187 return RawFunction::kAsync; |
| 5192 } | 5188 } |
| 5193 return RawFunction::kNoModifier; | 5189 return RawFunction::kNoModifier; |
| 5194 } | 5190 } |
| 5195 | 5191 |
| 5196 | 5192 |
| 5197 void Parser::ParseTopLevelFunction(TopLevel* top_level, | 5193 void Parser::ParseTopLevelFunction(TopLevel* top_level, |
| 5198 intptr_t metadata_pos) { | 5194 intptr_t metadata_pos) { |
| 5199 TRACE_PARSER("ParseTopLevelFunction"); | 5195 TRACE_PARSER("ParseTopLevelFunction"); |
| (...skipping 7030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12230 void Parser::SkipQualIdent() { | 12226 void Parser::SkipQualIdent() { |
| 12231 ASSERT(IsIdentifier()); | 12227 ASSERT(IsIdentifier()); |
| 12232 ConsumeToken(); | 12228 ConsumeToken(); |
| 12233 if (CurrentToken() == Token::kPERIOD) { | 12229 if (CurrentToken() == Token::kPERIOD) { |
| 12234 ConsumeToken(); // Consume the kPERIOD token. | 12230 ConsumeToken(); // Consume the kPERIOD token. |
| 12235 ExpectIdentifier("identifier expected after '.'"); | 12231 ExpectIdentifier("identifier expected after '.'"); |
| 12236 } | 12232 } |
| 12237 } | 12233 } |
| 12238 | 12234 |
| 12239 } // namespace dart | 12235 } // namespace dart |
| OLD | NEW |