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

Unified Diff: runtime/vm/parser.cc

Issue 11190009: Add warning flag for legacy getter syntax (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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
===================================================================
--- runtime/vm/parser.cc (revision 13746)
+++ runtime/vm/parser.cc (working copy)
@@ -33,6 +33,8 @@
"Warning on legacy map literal syntax (single type argument)");
DEFINE_FLAG(bool, warn_legacy_dynamic, false,
"Warning on legacy type Dynamic)");
+DEFINE_FLAG(bool, warn_legacy_getters, false,
+ "Warning on legacy getter syntax");
static void CheckedModeHandler(bool value) {
FLAG_enable_asserts = value;
@@ -2440,6 +2442,9 @@
// TODO(hausner): Remove this once the old getter syntax with
// empty parameter list is no longer supported.
if (CurrentToken() == Token::kLPAREN) {
+ if (FLAG_warn_legacy_getters) {
+ Warning("legacy getter syntax, remove parenthesis");
+ }
ConsumeToken();
ExpectToken(Token::kRPAREN);
}
@@ -3998,7 +4003,11 @@
const intptr_t accessor_pos = TokenPos();
ParamList params;
- // TODO(hausner): Remove the ( check once we remove old getter syntax.
+ if (FLAG_warn_legacy_getters &&
+ is_getter && (CurrentToken() == Token::kLPAREN)) {
+ Warning("legacy getter syntax, remove parenthesis");
+ }
+ // TODO(hausner): Remove the kLPAREN check once we remove old getter syntax.
if (!is_getter || (CurrentToken() == Token::kLPAREN)) {
const bool allow_explicit_default_values = true;
ParseFormalParameterList(allow_explicit_default_values, &params);
@@ -5875,8 +5884,6 @@
}
-// TODO(hausner): This structure can be simplified once the old catch
-// syntax is removed. All catch parameters in the new syntax are final.
struct CatchParamDesc {
CatchParamDesc()
: token_pos(0), type(NULL), var(NULL) { }
« 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