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 17 matching lines...) Expand all Loading... |
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, warn_legacy_dynamic, false, | 32 DEFINE_FLAG(bool, warn_legacy_dynamic, false, |
33 "Warning on legacy type Dynamic)"); | 33 "Warning on legacy type Dynamic)"); |
34 DEFINE_FLAG(bool, warn_legacy_getters, false, | 34 DEFINE_FLAG(bool, warn_legacy_getters, false, |
35 "Warning on legacy getter syntax"); | 35 "Warning on legacy getter syntax"); |
36 DEFINE_FLAG(bool, strict_function_literals, false, | 36 DEFINE_FLAG(bool, strict_function_literals, false, |
37 "enforce new function literal rules"); | 37 "enforce new function literal rules"); |
| 38 DEFINE_FLAG(bool, fail_legacy_abstract, false, |
| 39 "error on explicit use of abstract on class members"); |
38 | 40 |
39 static void CheckedModeHandler(bool value) { | 41 static void CheckedModeHandler(bool value) { |
40 FLAG_enable_asserts = value; | 42 FLAG_enable_asserts = value; |
41 FLAG_enable_type_checks = value; | 43 FLAG_enable_type_checks = value; |
42 } | 44 } |
43 | 45 |
44 // --enable-checked-mode and --checked both enable checked mode which is | 46 // --enable-checked-mode and --checked both enable checked mode which is |
45 // equivalent to setting --enable-asserts and --enable-type-checks. | 47 // equivalent to setting --enable-asserts and --enable-type-checks. |
46 DEFINE_FLAG_HANDLER(CheckedModeHandler, | 48 DEFINE_FLAG_HANDLER(CheckedModeHandler, |
47 enable_checked_mode, | 49 enable_checked_mode, |
(...skipping 2840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2888 } | 2890 } |
2889 } | 2891 } |
2890 | 2892 |
2891 | 2893 |
2892 void Parser::ParseClassMemberDefinition(ClassDesc* members) { | 2894 void Parser::ParseClassMemberDefinition(ClassDesc* members) { |
2893 TRACE_PARSER("ParseClassMemberDefinition"); | 2895 TRACE_PARSER("ParseClassMemberDefinition"); |
2894 MemberDesc member; | 2896 MemberDesc member; |
2895 current_member_ = &member; | 2897 current_member_ = &member; |
2896 if ((CurrentToken() == Token::kABSTRACT) && | 2898 if ((CurrentToken() == Token::kABSTRACT) && |
2897 (LookaheadToken(1) != Token::kLPAREN)) { | 2899 (LookaheadToken(1) != Token::kLPAREN)) { |
| 2900 if (FLAG_fail_legacy_abstract) { |
| 2901 ErrorMsg("illegal use of abstract"); |
| 2902 } |
2898 ConsumeToken(); | 2903 ConsumeToken(); |
2899 member.has_abstract = true; | 2904 member.has_abstract = true; |
2900 } | 2905 } |
2901 if ((CurrentToken() == Token::kEXTERNAL) && | 2906 if ((CurrentToken() == Token::kEXTERNAL) && |
2902 (LookaheadToken(1) != Token::kLPAREN)) { | 2907 (LookaheadToken(1) != Token::kLPAREN)) { |
2903 ConsumeToken(); | 2908 ConsumeToken(); |
2904 member.has_external = true; | 2909 member.has_external = true; |
2905 } | 2910 } |
2906 if ((CurrentToken() == Token::kSTATIC) && | 2911 if ((CurrentToken() == Token::kSTATIC) && |
2907 (LookaheadToken(1) != Token::kLPAREN)) { | 2912 (LookaheadToken(1) != Token::kLPAREN)) { |
(...skipping 7125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10033 void Parser::SkipQualIdent() { | 10038 void Parser::SkipQualIdent() { |
10034 ASSERT(IsIdentifier()); | 10039 ASSERT(IsIdentifier()); |
10035 ConsumeToken(); | 10040 ConsumeToken(); |
10036 if (CurrentToken() == Token::kPERIOD) { | 10041 if (CurrentToken() == Token::kPERIOD) { |
10037 ConsumeToken(); // Consume the kPERIOD token. | 10042 ConsumeToken(); // Consume the kPERIOD token. |
10038 ExpectIdentifier("identifier expected after '.'"); | 10043 ExpectIdentifier("identifier expected after '.'"); |
10039 } | 10044 } |
10040 } | 10045 } |
10041 | 10046 |
10042 } // namespace dart | 10047 } // namespace dart |
OLD | NEW |