Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Side by Side Diff: runtime/vm/parser.cc

Issue 2233493002: Put patch syntax warning behind a flag (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: wip Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); 45 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
46 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); 46 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef.");
47 // TODO(floitsch): remove the conditional-directive flag, once we publicly 47 // TODO(floitsch): remove the conditional-directive flag, once we publicly
48 // committed to the current version. 48 // committed to the current version.
49 DEFINE_FLAG(bool, conditional_directives, true, 49 DEFINE_FLAG(bool, conditional_directives, true,
50 "Enable conditional directives"); 50 "Enable conditional directives");
51 DEFINE_FLAG(bool, initializing_formal_access, false, 51 DEFINE_FLAG(bool, initializing_formal_access, false,
52 "Make initializing formal parameters visible in initializer list."); 52 "Make initializing formal parameters visible in initializer list.");
53 DEFINE_FLAG(bool, warn_super, false, 53 DEFINE_FLAG(bool, warn_super, false,
54 "Warning if super initializer not last in initializer list."); 54 "Warning if super initializer not last in initializer list.");
55 DEFINE_FLAG(bool, warn_patch, false, "Warn on old-style patch syntax.");
55 DEFINE_FLAG(bool, await_is_keyword, false, 56 DEFINE_FLAG(bool, await_is_keyword, false,
56 "await and yield are treated as proper keywords in synchronous code."); 57 "await and yield are treated as proper keywords in synchronous code.");
57 58
58 DECLARE_FLAG(bool, profile_vm); 59 DECLARE_FLAG(bool, profile_vm);
59 DECLARE_FLAG(bool, trace_service); 60 DECLARE_FLAG(bool, trace_service);
60 61
61 // Quick access to the current thread, isolate and zone. 62 // Quick access to the current thread, isolate and zone.
62 #define T (thread()) 63 #define T (thread())
63 #define I (isolate()) 64 #define I (isolate())
64 #define Z (zone()) 65 #define Z (zone())
(...skipping 4481 matching lines...) Expand 10 before | Expand all | Expand 10 after
4546 bool is_abstract = false; 4547 bool is_abstract = false;
4547 TokenPosition declaration_pos = 4548 TokenPosition declaration_pos =
4548 metadata_pos.IsReal() ? metadata_pos : TokenPos(); 4549 metadata_pos.IsReal() ? metadata_pos : TokenPos();
4549 if (is_patch_source() && IsPatchAnnotation(metadata_pos)) { 4550 if (is_patch_source() && IsPatchAnnotation(metadata_pos)) {
4550 is_patch = true; 4551 is_patch = true;
4551 metadata_pos = TokenPosition::kNoSource; 4552 metadata_pos = TokenPosition::kNoSource;
4552 declaration_pos = TokenPos(); 4553 declaration_pos = TokenPos();
4553 } else if (is_patch_source() && 4554 } else if (is_patch_source() &&
4554 (CurrentToken() == Token::kIDENT) && 4555 (CurrentToken() == Token::kIDENT) &&
4555 CurrentLiteral()->Equals("patch")) { 4556 CurrentLiteral()->Equals("patch")) {
4556 ReportWarning("deprecated use of patch 'keyword'"); 4557 if (FLAG_warn_patch) {
4558 ReportWarning("deprecated use of patch 'keyword'");
4559 }
4557 ConsumeToken(); 4560 ConsumeToken();
4558 is_patch = true; 4561 is_patch = true;
4559 } else if (CurrentToken() == Token::kABSTRACT) { 4562 } else if (CurrentToken() == Token::kABSTRACT) {
4560 is_abstract = true; 4563 is_abstract = true;
4561 ConsumeToken(); 4564 ConsumeToken();
4562 } 4565 }
4563 ExpectToken(Token::kCLASS); 4566 ExpectToken(Token::kCLASS);
4564 const TokenPosition classname_pos = TokenPos(); 4567 const TokenPosition classname_pos = TokenPos();
4565 String& class_name = *ExpectUserDefinedTypeIdentifier("class name expected"); 4568 String& class_name = *ExpectUserDefinedTypeIdentifier("class name expected");
4566 if (FLAG_trace_parser) { 4569 if (FLAG_trace_parser) {
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
5624 const bool is_static = true; 5627 const bool is_static = true;
5625 bool is_external = false; 5628 bool is_external = false;
5626 bool is_patch = false; 5629 bool is_patch = false;
5627 if (is_patch_source() && IsPatchAnnotation(metadata_pos)) { 5630 if (is_patch_source() && IsPatchAnnotation(metadata_pos)) {
5628 is_patch = true; 5631 is_patch = true;
5629 metadata_pos = TokenPosition::kNoSource; 5632 metadata_pos = TokenPosition::kNoSource;
5630 } else if (is_patch_source() && 5633 } else if (is_patch_source() &&
5631 (CurrentToken() == Token::kIDENT) && 5634 (CurrentToken() == Token::kIDENT) &&
5632 CurrentLiteral()->Equals("patch") && 5635 CurrentLiteral()->Equals("patch") &&
5633 (LookaheadToken(1) != Token::kLPAREN)) { 5636 (LookaheadToken(1) != Token::kLPAREN)) {
5634 ReportWarning("deprecated use of patch 'keyword'"); 5637 if (FLAG_warn_patch) {
5638 ReportWarning("deprecated use of patch 'keyword'");
5639 }
5635 ConsumeToken(); 5640 ConsumeToken();
5636 is_patch = true; 5641 is_patch = true;
5637 } else if (CurrentToken() == Token::kEXTERNAL) { 5642 } else if (CurrentToken() == Token::kEXTERNAL) {
5638 ConsumeToken(); 5643 ConsumeToken();
5639 is_external = true; 5644 is_external = true;
5640 } 5645 }
5641 if (CurrentToken() == Token::kVOID) { 5646 if (CurrentToken() == Token::kVOID) {
5642 ConsumeToken(); 5647 ConsumeToken();
5643 result_type = Type::VoidType(); 5648 result_type = Type::VoidType();
5644 } else { 5649 } else {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
5750 const bool is_static = true; 5755 const bool is_static = true;
5751 bool is_external = false; 5756 bool is_external = false;
5752 bool is_patch = false; 5757 bool is_patch = false;
5753 AbstractType& result_type = AbstractType::Handle(Z); 5758 AbstractType& result_type = AbstractType::Handle(Z);
5754 if (is_patch_source() && IsPatchAnnotation(metadata_pos)) { 5759 if (is_patch_source() && IsPatchAnnotation(metadata_pos)) {
5755 is_patch = true; 5760 is_patch = true;
5756 metadata_pos = TokenPosition::kNoSource; 5761 metadata_pos = TokenPosition::kNoSource;
5757 } else if (is_patch_source() && 5762 } else if (is_patch_source() &&
5758 (CurrentToken() == Token::kIDENT) && 5763 (CurrentToken() == Token::kIDENT) &&
5759 CurrentLiteral()->Equals("patch")) { 5764 CurrentLiteral()->Equals("patch")) {
5760 ReportWarning("deprecated use of patch 'keyword'"); 5765 if (FLAG_warn_patch) {
5766 ReportWarning("deprecated use of patch 'keyword'");
5767 }
5761 ConsumeToken(); 5768 ConsumeToken();
5762 is_patch = true; 5769 is_patch = true;
5763 } else if (CurrentToken() == Token::kEXTERNAL) { 5770 } else if (CurrentToken() == Token::kEXTERNAL) {
5764 ConsumeToken(); 5771 ConsumeToken();
5765 is_external = true; 5772 is_external = true;
5766 } 5773 }
5767 bool is_getter = (CurrentToken() == Token::kGET); 5774 bool is_getter = (CurrentToken() == Token::kGET);
5768 if (CurrentToken() == Token::kGET || 5775 if (CurrentToken() == Token::kGET ||
5769 CurrentToken() == Token::kSET) { 5776 CurrentToken() == Token::kSET) {
5770 ConsumeToken(); 5777 ConsumeToken();
(...skipping 8987 matching lines...) Expand 10 before | Expand all | Expand 10 after
14758 const ArgumentListNode& function_args, 14765 const ArgumentListNode& function_args,
14759 const LocalVariable* temp_for_last_arg, 14766 const LocalVariable* temp_for_last_arg,
14760 bool is_super_invocation) { 14767 bool is_super_invocation) {
14761 UNREACHABLE(); 14768 UNREACHABLE();
14762 return NULL; 14769 return NULL;
14763 } 14770 }
14764 14771
14765 } // namespace dart 14772 } // namespace dart
14766 14773
14767 #endif // DART_PRECOMPILED_RUNTIME 14774 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698