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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 3c955891673db5806721a0c2611e64f8a8a94b35..0543a078544629655bba5a78dd9f64936625b152 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -52,6 +52,7 @@ DEFINE_FLAG(bool, initializing_formal_access, false,
"Make initializing formal parameters visible in initializer list.");
DEFINE_FLAG(bool, warn_super, false,
"Warning if super initializer not last in initializer list.");
+DEFINE_FLAG(bool, warn_patch, false, "Warn on old-style patch syntax.");
DEFINE_FLAG(bool, await_is_keyword, false,
"await and yield are treated as proper keywords in synchronous code.");
@@ -4553,7 +4554,9 @@ void Parser::ParseClassDeclaration(const GrowableObjectArray& pending_classes,
} else if (is_patch_source() &&
(CurrentToken() == Token::kIDENT) &&
CurrentLiteral()->Equals("patch")) {
- ReportWarning("deprecated use of patch 'keyword'");
+ if (FLAG_warn_patch) {
+ ReportWarning("deprecated use of patch 'keyword'");
+ }
ConsumeToken();
is_patch = true;
} else if (CurrentToken() == Token::kABSTRACT) {
@@ -5631,7 +5634,9 @@ void Parser::ParseTopLevelFunction(TopLevel* top_level,
(CurrentToken() == Token::kIDENT) &&
CurrentLiteral()->Equals("patch") &&
(LookaheadToken(1) != Token::kLPAREN)) {
- ReportWarning("deprecated use of patch 'keyword'");
+ if (FLAG_warn_patch) {
+ ReportWarning("deprecated use of patch 'keyword'");
+ }
ConsumeToken();
is_patch = true;
} else if (CurrentToken() == Token::kEXTERNAL) {
@@ -5757,7 +5762,9 @@ void Parser::ParseTopLevelAccessor(TopLevel* top_level,
} else if (is_patch_source() &&
(CurrentToken() == Token::kIDENT) &&
CurrentLiteral()->Equals("patch")) {
- ReportWarning("deprecated use of patch 'keyword'");
+ if (FLAG_warn_patch) {
+ ReportWarning("deprecated use of patch 'keyword'");
+ }
ConsumeToken();
is_patch = true;
} else if (CurrentToken() == Token::kEXTERNAL) {
« 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