| 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/standard_ast_factory.dart'; | 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
| 9 import 'package:analyzer/dart/ast/token.dart'; | 9 import 'package:analyzer/dart/ast/token.dart'; |
| 10 import 'package:analyzer/dart/ast/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| (...skipping 13626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13637 void test_parseTypeAnnotation_function_returnType_classFunction() { | 13637 void test_parseTypeAnnotation_function_returnType_classFunction() { |
| 13638 createParser('Function v'); | 13638 createParser('Function v'); |
| 13639 TypeName functionType = parser.parseTypeAnnotation(false); | 13639 TypeName functionType = parser.parseTypeAnnotation(false); |
| 13640 expectNotNullIfNoErrors(functionType); | 13640 expectNotNullIfNoErrors(functionType); |
| 13641 listener.assertNoErrors(); | 13641 listener.assertNoErrors(); |
| 13642 } | 13642 } |
| 13643 | 13643 |
| 13644 @failingTest | 13644 @failingTest |
| 13645 void test_parseTypeAnnotation_function_returnType_function() { | 13645 void test_parseTypeAnnotation_function_returnType_function() { |
| 13646 createParser('A Function(B, C) Function(D) v'); | 13646 createParser('A Function(B, C) Function(D) v'); |
| 13647 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13647 // TODO(scheglov) improve the test to verify also the node properties |
| 13648 var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType; |
| 13648 expectNotNullIfNoErrors(functionType); | 13649 expectNotNullIfNoErrors(functionType); |
| 13649 listener.assertNoErrors(); | 13650 listener.assertNoErrors(); |
| 13650 } | 13651 } |
| 13651 | 13652 |
| 13652 @failingTest | 13653 @failingTest |
| 13653 void test_parseTypeAnnotation_function_returnType_noParameters() { | 13654 void test_parseTypeAnnotation_function_returnType_noParameters() { |
| 13654 createParser('List<int> Function()'); | 13655 createParser('List<int> Function()'); |
| 13655 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13656 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13656 expectNotNullIfNoErrors(functionType); | 13657 expectNotNullIfNoErrors(functionType); |
| 13657 listener.assertNoErrors(); | 13658 listener.assertNoErrors(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 13688 parameter = parameters[1]; | 13689 parameter = parameters[1]; |
| 13689 expect(parameter.identifier, isNotNull); | 13690 expect(parameter.identifier, isNotNull); |
| 13690 expect(parameter.identifier.name, 'i'); | 13691 expect(parameter.identifier.name, 'i'); |
| 13691 expect(parameter.type, new isInstanceOf<TypeName>()); | 13692 expect(parameter.type, new isInstanceOf<TypeName>()); |
| 13692 expect((parameter.type as TypeName).name.name, 'int'); | 13693 expect((parameter.type as TypeName).name.name, 'int'); |
| 13693 } | 13694 } |
| 13694 | 13695 |
| 13695 @failingTest | 13696 @failingTest |
| 13696 void test_parseTypeAnnotation_function_returnType_simple() { | 13697 void test_parseTypeAnnotation_function_returnType_simple() { |
| 13697 createParser('A Function(B, C) v'); | 13698 createParser('A Function(B, C) v'); |
| 13698 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13699 // TODO(scheglov) improve the test to verify also the node properties |
| 13700 var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType; |
| 13699 expectNotNullIfNoErrors(functionType); | 13701 expectNotNullIfNoErrors(functionType); |
| 13700 listener.assertNoErrors(); | 13702 listener.assertNoErrors(); |
| 13701 } | 13703 } |
| 13702 | 13704 |
| 13703 @failingTest | 13705 @failingTest |
| 13704 void test_parseTypeAnnotation_function_returnType_typeParameters() { | 13706 void test_parseTypeAnnotation_function_returnType_typeParameters() { |
| 13705 createParser('List<T> Function<T>()'); | 13707 createParser('List<T> Function<T>()'); |
| 13706 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13708 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13707 expectNotNullIfNoErrors(functionType); | 13709 expectNotNullIfNoErrors(functionType); |
| 13708 listener.assertNoErrors(); | 13710 listener.assertNoErrors(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 13729 expect(typeParameters, isNotNull); | 13731 expect(typeParameters, isNotNull); |
| 13730 expect(typeParameters.typeParameters, hasLength(1)); | 13732 expect(typeParameters.typeParameters, hasLength(1)); |
| 13731 FormalParameterList parameterList = functionType.parameters; | 13733 FormalParameterList parameterList = functionType.parameters; |
| 13732 expect(parameterList, isNotNull); | 13734 expect(parameterList, isNotNull); |
| 13733 expect(parameterList.parameters, hasLength(2)); | 13735 expect(parameterList.parameters, hasLength(2)); |
| 13734 } | 13736 } |
| 13735 | 13737 |
| 13736 @failingTest | 13738 @failingTest |
| 13737 void test_parseTypeAnnotation_function_returnType_withArguments() { | 13739 void test_parseTypeAnnotation_function_returnType_withArguments() { |
| 13738 createParser('A<B> Function(C) v'); | 13740 createParser('A<B> Function(C) v'); |
| 13739 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13741 // TODO(scheglov) improve this test to verify also the node properties |
| 13742 var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType; |
| 13740 expectNotNullIfNoErrors(functionType); | 13743 expectNotNullIfNoErrors(functionType); |
| 13741 listener.assertNoErrors(); | 13744 listener.assertNoErrors(); |
| 13742 } | 13745 } |
| 13743 | 13746 |
| 13744 void test_parseTypeAnnotation_named() { | 13747 void test_parseTypeAnnotation_named() { |
| 13745 createParser('A<B> v'); | 13748 createParser('A<B> v'); |
| 13746 TypeName typeName = parser.parseTypeAnnotation(false); | 13749 TypeName typeName = parser.parseTypeAnnotation(false); |
| 13747 expectNotNullIfNoErrors(typeName); | 13750 expectNotNullIfNoErrors(typeName); |
| 13748 listener.assertNoErrors(); | 13751 listener.assertNoErrors(); |
| 13749 } | 13752 } |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14601 CompilationUnit _parseDirectives(String source, | 14604 CompilationUnit _parseDirectives(String source, |
| 14602 [List<ErrorCode> errorCodes = const <ErrorCode>[]]) { | 14605 [List<ErrorCode> errorCodes = const <ErrorCode>[]]) { |
| 14603 createParser(source); | 14606 createParser(source); |
| 14604 CompilationUnit unit = parser.parseDirectives2(); | 14607 CompilationUnit unit = parser.parseDirectives2(); |
| 14605 expect(unit, isNotNull); | 14608 expect(unit, isNotNull); |
| 14606 expect(unit.declarations, hasLength(0)); | 14609 expect(unit.declarations, hasLength(0)); |
| 14607 listener.assertErrorsWithCodes(errorCodes); | 14610 listener.assertErrorsWithCodes(errorCodes); |
| 14608 return unit; | 14611 return unit; |
| 14609 } | 14612 } |
| 14610 } | 14613 } |
| OLD | NEW |