| 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 11346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11357 createParser('() => 42'); | 11357 createParser('() => 42'); |
| 11358 Expression expression = parser.parsePrimaryExpression(); | 11358 Expression expression = parser.parsePrimaryExpression(); |
| 11359 expectNotNullIfNoErrors(expression); | 11359 expectNotNullIfNoErrors(expression); |
| 11360 listener.assertNoErrors(); | 11360 listener.assertNoErrors(); |
| 11361 expect(expression, new isInstanceOf<FunctionExpression>()); | 11361 expect(expression, new isInstanceOf<FunctionExpression>()); |
| 11362 FunctionExpression functionExpression = expression; | 11362 FunctionExpression functionExpression = expression; |
| 11363 expect(functionExpression.parameters, isNotNull); | 11363 expect(functionExpression.parameters, isNotNull); |
| 11364 expect(functionExpression.body, isNotNull); | 11364 expect(functionExpression.body, isNotNull); |
| 11365 } | 11365 } |
| 11366 | 11366 |
| 11367 void test_parsePrimaryExpression_genericFunctionExpression() { |
| 11368 enableGenericMethods = true; |
| 11369 createParser('<X, Y>(Map<X, Y> m, X x) => m[x]'); |
| 11370 Expression expression = parser.parsePrimaryExpression(); |
| 11371 expectNotNullIfNoErrors(expression); |
| 11372 listener.assertNoErrors(); |
| 11373 expect(expression, new isInstanceOf<FunctionExpression>()); |
| 11374 FunctionExpression function = expression; |
| 11375 expect(function.typeParameters, isNotNull); |
| 11376 } |
| 11377 |
| 11367 void test_parsePrimaryExpression_hex() { | 11378 void test_parsePrimaryExpression_hex() { |
| 11368 String hexLiteral = "3F"; | 11379 String hexLiteral = "3F"; |
| 11369 createParser('0x$hexLiteral'); | 11380 createParser('0x$hexLiteral'); |
| 11370 Expression expression = parser.parsePrimaryExpression(); | 11381 Expression expression = parser.parsePrimaryExpression(); |
| 11371 expectNotNullIfNoErrors(expression); | 11382 expectNotNullIfNoErrors(expression); |
| 11372 listener.assertNoErrors(); | 11383 listener.assertNoErrors(); |
| 11373 expect(expression, new isInstanceOf<IntegerLiteral>()); | 11384 expect(expression, new isInstanceOf<IntegerLiteral>()); |
| 11374 IntegerLiteral literal = expression; | 11385 IntegerLiteral literal = expression; |
| 11375 expect(literal.literal, isNotNull); | 11386 expect(literal.literal, isNotNull); |
| 11376 expect(literal.value, int.parse(hexLiteral, radix: 16)); | 11387 expect(literal.value, int.parse(hexLiteral, radix: 16)); |
| (...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13459 CompilationUnit _parseDirectives(String source, | 13470 CompilationUnit _parseDirectives(String source, |
| 13460 [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) { | 13471 [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) { |
| 13461 createParser(source); | 13472 createParser(source); |
| 13462 CompilationUnit unit = parser.parseDirectives2(); | 13473 CompilationUnit unit = parser.parseDirectives2(); |
| 13463 expect(unit, isNotNull); | 13474 expect(unit, isNotNull); |
| 13464 expect(unit.declarations, hasLength(0)); | 13475 expect(unit.declarations, hasLength(0)); |
| 13465 listener.assertErrorsWithCodes(errorCodes); | 13476 listener.assertErrorsWithCodes(errorCodes); |
| 13466 return unit; | 13477 return unit; |
| 13467 } | 13478 } |
| 13468 } | 13479 } |
| OLD | NEW |