Chromium Code Reviews| Index: runtime/vm/parser.cc |
| diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
| index 92ba4ff121e46e1e81cdc34a06de11ae15e468f9..acf5f9348c6cea90557488c524edc567dbb11445 100644 |
| --- a/runtime/vm/parser.cc |
| +++ b/runtime/vm/parser.cc |
| @@ -45,6 +45,7 @@ namespace dart { |
| DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\"."); |
| DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); |
| DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); |
| +DEFINE_FLAG(bool, warn_new_tearoff_syntax, true, "Warning on new tear off."); |
| // TODO(floitsch): remove the conditional-directive flag, once we publicly |
| // committed to the current version. |
| DEFINE_FLAG(bool, |
| @@ -11666,6 +11667,11 @@ AstNode* Parser::ParseSelectors(AstNode* primary, bool is_cascade) { |
| // Closurization e#m of getter, setter, method or operator. |
| AstNode* Parser::ParseClosurization(AstNode* primary) { |
| ExpectToken(Token::kHASH); |
| + if (FLAG_warn_new_tearoff_syntax) { |
|
hausner
2016/11/11 18:10:38
Nit: I'd move the warning to before the ExpectTpke
siva
2016/11/11 18:58:01
Done.
|
| + ReportWarning( |
| + "Tear-offs using the x#id syntax is a deprecated feature," |
| + "it will not be supported in the next release"); |
| + } |
| TokenPosition property_pos = TokenPos(); |
| bool is_setter_name = false; |
| @@ -13251,6 +13257,11 @@ void Parser::ParseConstructorClosurization(Function* constructor, |
| ASSERT(prefix.IsNull() || prefix.is_loaded()); |
| ASSERT(!type.IsMalformed() && !type.IsTypeParameter()); |
| ExpectToken(Token::kHASH); |
| + if (FLAG_warn_new_tearoff_syntax) { |
|
hausner
2016/11/11 18:10:38
Nit: I'd move the check to before the ExpectToken(
siva
2016/11/11 18:58:00
Done.
|
| + ReportWarning( |
| + "Tear-offs using the x#id syntax is a deprecated feature," |
| + "it will not be supported in the next release"); |
| + } |
| String* named_constructor = NULL; |
| if (IsIdentifier()) { |
| named_constructor = CurrentLiteral(); |
| @@ -13348,6 +13359,11 @@ AstNode* Parser::ParseNewOperator(Token::Kind op_kind) { |
| if (is_const) { |
| ReportError("tear-off closure not allowed with const allocation"); |
| } |
| + if (FLAG_warn_new_tearoff_syntax) { |
| + ReportWarning( |
| + "Tear-offs using the x#id syntax is a deprecated feature," |
| + "and will not be supported in the next release"); |
| + } |
| ConsumeToken(); |
| if (IsIdentifier()) { |
| named_constructor = ExpectIdentifier("name of constructor expected"); |