Skip to content

Commit

Permalink
Always parse 'x.y' as a prefixed identifier.
Browse files Browse the repository at this point in the history
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2722153003 .
  • Loading branch information
scheglov committed Mar 1, 2017
1 parent d921f94 commit cc7c611
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
5 changes: 0 additions & 5 deletions pkg/analyzer/lib/src/generated/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions pkg/analyzer/test/generated/parser_fasta_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
10 changes: 5 additions & 5 deletions pkg/analyzer/test/generated/parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit cc7c611

Please sign in to comment.