From cc7c61124b02901c5cdd0e0400bc4b515b504f56 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Wed, 1 Mar 2017 10:42:51 -0800 Subject: [PATCH] Always parse 'x.y' as a prefixed identifier. R=brianwilkerson@google.com BUG= Review-Url: https://codereview.chromium.org/2722153003 . --- pkg/analyzer/lib/src/generated/parser.dart | 5 ----- pkg/analyzer/test/generated/parser_fasta_test.dart | 6 ++++++ pkg/analyzer/test/generated/parser_test.dart | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart index e8bc7dd5d90..1ccc89f9ecd 100644 --- a/pkg/analyzer/lib/src/generated/parser.dart +++ b/pkg/analyzer/lib/src/generated/parser.dart @@ -6357,11 +6357,6 @@ class Parser { Expression selectorExpression = parseAssignableSelector( expression, isOptional || (expression is PrefixedIdentifier)); if (identical(selectorExpression, expression)) { - if (!isOptional && (expression is PrefixedIdentifier)) { - PrefixedIdentifier identifier = expression as PrefixedIdentifier; - expression = astFactory.propertyAccess( - identifier.prefix, identifier.period, identifier.identifier); - } return expression; } expression = selectorExpression; diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart index 9120aeffd29..4b7d002a0d0 100644 --- a/pkg/analyzer/test/generated/parser_fasta_test.dart +++ b/pkg/analyzer/test/generated/parser_fasta_test.dart @@ -434,6 +434,12 @@ class ExpressionParserTest_Fasta extends FastaParserTestCase .test_parseAssignableExpression_identifier_args_dot_typeParameterComments(); } + @override + @failingTest + void test_parseAssignableExpression_identifier_dot() { + super.test_parseAssignableExpression_identifier_dot(); + } + @override @failingTest void test_parseAssignableExpression_identifier_question_dot() { diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart index ae8b9c2dcea..4a26ac12896 100644 --- a/pkg/analyzer/test/generated/parser_test.dart +++ b/pkg/analyzer/test/generated/parser_test.dart @@ -4180,11 +4180,11 @@ abstract class ExpressionParserTestMixin implements AbstractParserTestCase { Expression expression = parseAssignableExpression('x.y', false); expect(expression, isNotNull); assertNoErrors(); - var propertyAccess = expression as PropertyAccess; - expect(propertyAccess.target, isNotNull); - expect(propertyAccess.operator, isNotNull); - expect(propertyAccess.operator.type, TokenType.PERIOD); - expect(propertyAccess.propertyName, isNotNull); + var identifier = expression as PrefixedIdentifier; + expect(identifier.prefix.name, 'x'); + expect(identifier.period, isNotNull); + expect(identifier.period.type, TokenType.PERIOD); + expect(identifier.identifier.name, 'y'); } void test_parseAssignableExpression_identifier_index() {