OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.test.generated.parser_test; | 5 library analyzer.test.generated.parser_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
(...skipping 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3116 | 3116 |
3117 void test_additiveExpression_super() { | 3117 void test_additiveExpression_super() { |
3118 BinaryExpression expression = parseExpression("super + +", [ | 3118 BinaryExpression expression = parseExpression("super + +", [ |
3119 ParserErrorCode.MISSING_IDENTIFIER, | 3119 ParserErrorCode.MISSING_IDENTIFIER, |
3120 ParserErrorCode.MISSING_IDENTIFIER | 3120 ParserErrorCode.MISSING_IDENTIFIER |
3121 ]); | 3121 ]); |
3122 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, | 3122 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, |
3123 BinaryExpression, expression.leftOperand); | 3123 BinaryExpression, expression.leftOperand); |
3124 } | 3124 } |
3125 | 3125 |
| 3126 void test_assignableSelector() { |
| 3127 IndexExpression expression = |
| 3128 parseExpression("a.b[]", [ParserErrorCode.MISSING_IDENTIFIER]); |
| 3129 Expression index = expression.index; |
| 3130 expect(index, new isInstanceOf<SimpleIdentifier>()); |
| 3131 expect(index.isSynthetic, isTrue); |
| 3132 } |
| 3133 |
3126 void test_assignmentExpression_missing_compound1() { | 3134 void test_assignmentExpression_missing_compound1() { |
3127 AssignmentExpression expression = | 3135 AssignmentExpression expression = |
3128 parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]); | 3136 parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]); |
3129 Expression syntheticExpression = expression.leftHandSide; | 3137 Expression syntheticExpression = expression.leftHandSide; |
3130 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, | 3138 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, |
3131 SimpleIdentifier, syntheticExpression); | 3139 SimpleIdentifier, syntheticExpression); |
3132 expect(syntheticExpression.isSynthetic, isTrue); | 3140 expect(syntheticExpression.isSynthetic, isTrue); |
3133 } | 3141 } |
3134 | 3142 |
3135 void test_assignmentExpression_missing_compound2() { | 3143 void test_assignmentExpression_missing_compound2() { |
(...skipping 10315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13451 CompilationUnit _parseDirectives(String source, | 13459 CompilationUnit _parseDirectives(String source, |
13452 [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) { | 13460 [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) { |
13453 createParser(source); | 13461 createParser(source); |
13454 CompilationUnit unit = parser.parseDirectives2(); | 13462 CompilationUnit unit = parser.parseDirectives2(); |
13455 expect(unit, isNotNull); | 13463 expect(unit, isNotNull); |
13456 expect(unit.declarations, hasLength(0)); | 13464 expect(unit.declarations, hasLength(0)); |
13457 listener.assertErrorsWithCodes(errorCodes); | 13465 listener.assertErrorsWithCodes(errorCodes); |
13458 return unit; | 13466 return unit; |
13459 } | 13467 } |
13460 } | 13468 } |
OLD | NEW |