| 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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); | 25 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); |
| 26 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); | 26 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); |
| 27 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); | 27 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); |
| 28 DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors."); | 28 DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors."); |
| 29 DEFINE_FLAG(bool, silent_warnings, false, "Silence warnings."); | 29 DEFINE_FLAG(bool, silent_warnings, false, "Silence warnings."); |
| 30 DEFINE_FLAG(bool, warn_legacy_map_literal, false, | 30 DEFINE_FLAG(bool, warn_legacy_map_literal, false, |
| 31 "Warning on legacy map literal syntax (single type argument)"); | 31 "Warning on legacy map literal syntax (single type argument)"); |
| 32 DEFINE_FLAG(bool, strict_function_literals, false, | 32 DEFINE_FLAG(bool, strict_function_literals, false, |
| 33 "enforce new function literal rules"); | 33 "enforce new function literal rules"); |
| 34 DEFINE_FLAG(bool, fail_legacy_abstract, false, | |
| 35 "error on explicit use of abstract on class members"); | |
| 36 | 34 |
| 37 static void CheckedModeHandler(bool value) { | 35 static void CheckedModeHandler(bool value) { |
| 38 FLAG_enable_asserts = value; | 36 FLAG_enable_asserts = value; |
| 39 FLAG_enable_type_checks = value; | 37 FLAG_enable_type_checks = value; |
| 40 } | 38 } |
| 41 | 39 |
| 42 // --enable-checked-mode and --checked both enable checked mode which is | 40 // --enable-checked-mode and --checked both enable checked mode which is |
| 43 // equivalent to setting --enable-asserts and --enable-type-checks. | 41 // equivalent to setting --enable-asserts and --enable-type-checks. |
| 44 DEFINE_FLAG_HANDLER(CheckedModeHandler, | 42 DEFINE_FLAG_HANDLER(CheckedModeHandler, |
| 45 enable_checked_mode, | 43 enable_checked_mode, |
| (...skipping 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2860 ErrorMsg(member.name_pos, "operator %s expects %"Pd" argument(s)", | 2858 ErrorMsg(member.name_pos, "operator %s expects %"Pd" argument(s)", |
| 2861 member.name->ToCString(), (expected_num_parameters - 1)); | 2859 member.name->ToCString(), (expected_num_parameters - 1)); |
| 2862 } | 2860 } |
| 2863 } | 2861 } |
| 2864 | 2862 |
| 2865 | 2863 |
| 2866 void Parser::ParseClassMemberDefinition(ClassDesc* members) { | 2864 void Parser::ParseClassMemberDefinition(ClassDesc* members) { |
| 2867 TRACE_PARSER("ParseClassMemberDefinition"); | 2865 TRACE_PARSER("ParseClassMemberDefinition"); |
| 2868 MemberDesc member; | 2866 MemberDesc member; |
| 2869 current_member_ = &member; | 2867 current_member_ = &member; |
| 2870 if ((CurrentToken() == Token::kABSTRACT) && | |
| 2871 (LookaheadToken(1) != Token::kLPAREN)) { | |
| 2872 if (FLAG_fail_legacy_abstract) { | |
| 2873 ErrorMsg("illegal use of abstract"); | |
| 2874 } | |
| 2875 ConsumeToken(); | |
| 2876 member.has_abstract = true; | |
| 2877 } | |
| 2878 if ((CurrentToken() == Token::kEXTERNAL) && | 2868 if ((CurrentToken() == Token::kEXTERNAL) && |
| 2879 (LookaheadToken(1) != Token::kLPAREN)) { | 2869 (LookaheadToken(1) != Token::kLPAREN)) { |
| 2880 ConsumeToken(); | 2870 ConsumeToken(); |
| 2881 member.has_external = true; | 2871 member.has_external = true; |
| 2882 } | 2872 } |
| 2883 if ((CurrentToken() == Token::kSTATIC) && | 2873 if ((CurrentToken() == Token::kSTATIC) && |
| 2884 (LookaheadToken(1) != Token::kLPAREN)) { | 2874 (LookaheadToken(1) != Token::kLPAREN)) { |
| 2885 ConsumeToken(); | 2875 ConsumeToken(); |
| 2886 member.has_static = true; | 2876 member.has_static = true; |
| 2887 } | 2877 } |
| (...skipping 6850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9738 void Parser::SkipQualIdent() { | 9728 void Parser::SkipQualIdent() { |
| 9739 ASSERT(IsIdentifier()); | 9729 ASSERT(IsIdentifier()); |
| 9740 ConsumeToken(); | 9730 ConsumeToken(); |
| 9741 if (CurrentToken() == Token::kPERIOD) { | 9731 if (CurrentToken() == Token::kPERIOD) { |
| 9742 ConsumeToken(); // Consume the kPERIOD token. | 9732 ConsumeToken(); // Consume the kPERIOD token. |
| 9743 ExpectIdentifier("identifier expected after '.'"); | 9733 ExpectIdentifier("identifier expected after '.'"); |
| 9744 } | 9734 } |
| 9745 } | 9735 } |
| 9746 | 9736 |
| 9747 } // namespace dart | 9737 } // namespace dart |
| OLD | NEW |