| 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 5987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5998 expect(field.metadata, hasLength(0)); | 5998 expect(field.metadata, hasLength(0)); |
| 5999 expect(field.staticKeyword, isNull); | 5999 expect(field.staticKeyword, isNull); |
| 6000 VariableDeclarationList list = field.fields; | 6000 VariableDeclarationList list = field.fields; |
| 6001 expect(list, isNotNull); | 6001 expect(list, isNotNull); |
| 6002 NodeList<VariableDeclaration> variables = list.variables; | 6002 NodeList<VariableDeclaration> variables = list.variables; |
| 6003 expect(variables, hasLength(1)); | 6003 expect(variables, hasLength(1)); |
| 6004 VariableDeclaration variable = variables[0]; | 6004 VariableDeclaration variable = variables[0]; |
| 6005 expect(variable.name, isNotNull); | 6005 expect(variable.name, isNotNull); |
| 6006 } | 6006 } |
| 6007 | 6007 |
| 6008 @failingTest |
| 6008 void test_parseClassMember_getter_functionType() { | 6009 void test_parseClassMember_getter_functionType() { |
| 6009 createParser('int Function(int) get g {}'); | 6010 createParser('int Function(int) get g {}'); |
| 6010 ClassMember member = parser.parseClassMember('C'); | 6011 ClassMember member = parser.parseClassMember('C'); |
| 6011 expectNotNullIfNoErrors(member); | 6012 expectNotNullIfNoErrors(member); |
| 6012 listener.assertNoErrors(); | 6013 listener.assertNoErrors(); |
| 6013 expect(member, new isInstanceOf<MethodDeclaration>()); | 6014 expect(member, new isInstanceOf<MethodDeclaration>()); |
| 6014 MethodDeclaration method = member; | 6015 MethodDeclaration method = member; |
| 6015 expect(method.documentationComment, isNull); | 6016 expect(method.documentationComment, isNull); |
| 6016 expect(method.externalKeyword, isNull); | 6017 expect(method.externalKeyword, isNull); |
| 6017 expect(method.modifierKeyword, isNull); | 6018 expect(method.modifierKeyword, isNull); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6327 expect(method.modifierKeyword, isNull); | 6328 expect(method.modifierKeyword, isNull); |
| 6328 expect(method.propertyKeyword, isNull); | 6329 expect(method.propertyKeyword, isNull); |
| 6329 expect(method.returnType, isNotNull); | 6330 expect(method.returnType, isNotNull); |
| 6330 expect(method.name, isNotNull); | 6331 expect(method.name, isNotNull); |
| 6331 expect(method.operatorKeyword, isNull); | 6332 expect(method.operatorKeyword, isNull); |
| 6332 expect(method.typeParameters, isNull); | 6333 expect(method.typeParameters, isNull); |
| 6333 expect(method.parameters, isNotNull); | 6334 expect(method.parameters, isNotNull); |
| 6334 expect(method.body, isNotNull); | 6335 expect(method.body, isNotNull); |
| 6335 } | 6336 } |
| 6336 | 6337 |
| 6338 @failingTest |
| 6337 void test_parseClassMember_method_returnType_functionType() { | 6339 void test_parseClassMember_method_returnType_functionType() { |
| 6338 createParser('int Function(String) m() {}'); | 6340 createParser('int Function(String) m() {}'); |
| 6339 ClassMember member = parser.parseClassMember('C'); | 6341 ClassMember member = parser.parseClassMember('C'); |
| 6340 expectNotNullIfNoErrors(member); | 6342 expectNotNullIfNoErrors(member); |
| 6341 listener.assertNoErrors(); | 6343 listener.assertNoErrors(); |
| 6342 expect(member, new isInstanceOf<MethodDeclaration>()); | 6344 expect(member, new isInstanceOf<MethodDeclaration>()); |
| 6343 MethodDeclaration method = member; | 6345 MethodDeclaration method = member; |
| 6344 expect(method.documentationComment, isNull); | 6346 expect(method.documentationComment, isNull); |
| 6345 expect(method.externalKeyword, isNull); | 6347 expect(method.externalKeyword, isNull); |
| 6346 expect(method.modifierKeyword, isNull); | 6348 expect(method.modifierKeyword, isNull); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6442 expect(method.modifierKeyword, isNull); | 6444 expect(method.modifierKeyword, isNull); |
| 6443 expect(method.propertyKeyword, isNull); | 6445 expect(method.propertyKeyword, isNull); |
| 6444 expect(method.returnType, isNotNull); | 6446 expect(method.returnType, isNotNull); |
| 6445 expect(method.name, isNotNull); | 6447 expect(method.name, isNotNull); |
| 6446 expect(method.operatorKeyword, isNull); | 6448 expect(method.operatorKeyword, isNull); |
| 6447 expect(method.typeParameters, isNull); | 6449 expect(method.typeParameters, isNull); |
| 6448 expect(method.parameters, isNotNull); | 6450 expect(method.parameters, isNotNull); |
| 6449 expect(method.body, isNotNull); | 6451 expect(method.body, isNotNull); |
| 6450 } | 6452 } |
| 6451 | 6453 |
| 6454 @failingTest |
| 6452 void test_parseClassMember_operator_functionType() { | 6455 void test_parseClassMember_operator_functionType() { |
| 6453 createParser('int Function() operator +(int Function() f) {}'); | 6456 createParser('int Function() operator +(int Function() f) {}'); |
| 6454 ClassMember member = parser.parseClassMember('C'); | 6457 ClassMember member = parser.parseClassMember('C'); |
| 6455 expectNotNullIfNoErrors(member); | 6458 expectNotNullIfNoErrors(member); |
| 6456 listener.assertNoErrors(); | 6459 listener.assertNoErrors(); |
| 6457 expect(member, new isInstanceOf<MethodDeclaration>()); | 6460 expect(member, new isInstanceOf<MethodDeclaration>()); |
| 6458 MethodDeclaration method = member; | 6461 MethodDeclaration method = member; |
| 6459 expect(method.documentationComment, isNull); | 6462 expect(method.documentationComment, isNull); |
| 6460 expect(method.externalKeyword, isNull); | 6463 expect(method.externalKeyword, isNull); |
| 6461 expect(method.modifierKeyword, isNull); | 6464 expect(method.modifierKeyword, isNull); |
| (...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8752 defaultParameter.parameter as SimpleFormalParameter; | 8755 defaultParameter.parameter as SimpleFormalParameter; |
| 8753 expect(simpleParameter.identifier, isNotNull); | 8756 expect(simpleParameter.identifier, isNotNull); |
| 8754 expect(simpleParameter.keyword, isNotNull); | 8757 expect(simpleParameter.keyword, isNotNull); |
| 8755 expect(simpleParameter.type, isNotNull); | 8758 expect(simpleParameter.type, isNotNull); |
| 8756 expect(simpleParameter.kind, kind); | 8759 expect(simpleParameter.kind, kind); |
| 8757 expect(defaultParameter.separator, isNotNull); | 8760 expect(defaultParameter.separator, isNotNull); |
| 8758 expect(defaultParameter.defaultValue, isNotNull); | 8761 expect(defaultParameter.defaultValue, isNotNull); |
| 8759 expect(defaultParameter.kind, kind); | 8762 expect(defaultParameter.kind, kind); |
| 8760 } | 8763 } |
| 8761 | 8764 |
| 8765 @failingTest |
| 8762 void test_parseFormalParameter_nonFinal_withType_function() { | 8766 void test_parseFormalParameter_nonFinal_withType_function() { |
| 8763 ParameterKind kind = ParameterKind.REQUIRED; | 8767 ParameterKind kind = ParameterKind.REQUIRED; |
| 8764 createParser('String Function(int) a'); | 8768 createParser('String Function(int) a'); |
| 8765 FormalParameter parameter = parser.parseFormalParameter(kind); | 8769 FormalParameter parameter = parser.parseFormalParameter(kind); |
| 8766 expectNotNullIfNoErrors(parameter); | 8770 expectNotNullIfNoErrors(parameter); |
| 8767 listener.assertNoErrors(); | 8771 listener.assertNoErrors(); |
| 8768 expect(parameter, new isInstanceOf<SimpleFormalParameter>()); | 8772 expect(parameter, new isInstanceOf<SimpleFormalParameter>()); |
| 8769 SimpleFormalParameter simpleParameter = parameter; | 8773 SimpleFormalParameter simpleParameter = parameter; |
| 8770 expect(simpleParameter.identifier, isNotNull); | 8774 expect(simpleParameter.identifier, isNotNull); |
| 8771 expect(simpleParameter.keyword, isNull); | 8775 expect(simpleParameter.keyword, isNull); |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9732 createParser('<E>(E i) => i++'); | 9736 createParser('<E>(E i) => i++'); |
| 9733 FunctionExpression expression = parser.parseFunctionExpression(); | 9737 FunctionExpression expression = parser.parseFunctionExpression(); |
| 9734 expectNotNullIfNoErrors(expression); | 9738 expectNotNullIfNoErrors(expression); |
| 9735 listener.assertNoErrors(); | 9739 listener.assertNoErrors(); |
| 9736 expect(expression.body, isNotNull); | 9740 expect(expression.body, isNotNull); |
| 9737 expect(expression.typeParameters, isNotNull); | 9741 expect(expression.typeParameters, isNotNull); |
| 9738 expect(expression.parameters, isNotNull); | 9742 expect(expression.parameters, isNotNull); |
| 9739 expect((expression.body as ExpressionFunctionBody).semicolon, isNull); | 9743 expect((expression.body as ExpressionFunctionBody).semicolon, isNull); |
| 9740 } | 9744 } |
| 9741 | 9745 |
| 9746 @failingTest |
| 9742 void test_parseGenericTypeAlias_noTypeParameters() { | 9747 void test_parseGenericTypeAlias_noTypeParameters() { |
| 9743 createParser('F = int Function(int);'); | 9748 createParser('F = int Function(int);'); |
| 9744 GenericTypeAlias alias = | 9749 GenericTypeAlias alias = |
| 9745 parser.parseGenericTypeAlias(emptyCommentAndMetadata(), null); | 9750 parser.parseGenericTypeAlias(emptyCommentAndMetadata(), null); |
| 9746 expectNotNullIfNoErrors(alias); | 9751 expectNotNullIfNoErrors(alias); |
| 9747 listener.assertNoErrors(); | 9752 listener.assertNoErrors(); |
| 9748 expect(alias.name, isNotNull); | 9753 expect(alias.name, isNotNull); |
| 9749 expect(alias.name.name, 'F'); | 9754 expect(alias.name.name, 'F'); |
| 9750 expect(alias.typeParameters, isNull); | 9755 expect(alias.typeParameters, isNull); |
| 9751 expect(alias.equals, isNotNull); | 9756 expect(alias.equals, isNotNull); |
| 9752 expect(alias.functionType, isNotNull); | 9757 expect(alias.functionType, isNotNull); |
| 9753 expect(alias.semicolon, isNotNull); | 9758 expect(alias.semicolon, isNotNull); |
| 9754 } | 9759 } |
| 9755 | 9760 |
| 9761 @failingTest |
| 9756 void test_parseGenericTypeAlias_typeParameters() { | 9762 void test_parseGenericTypeAlias_typeParameters() { |
| 9757 createParser('F<T> = T Function(T);'); | 9763 createParser('F<T> = T Function(T);'); |
| 9758 GenericTypeAlias alias = | 9764 GenericTypeAlias alias = |
| 9759 parser.parseGenericTypeAlias(emptyCommentAndMetadata(), null); | 9765 parser.parseGenericTypeAlias(emptyCommentAndMetadata(), null); |
| 9760 expectNotNullIfNoErrors(alias); | 9766 expectNotNullIfNoErrors(alias); |
| 9761 listener.assertNoErrors(); | 9767 listener.assertNoErrors(); |
| 9762 expect(alias.name, isNotNull); | 9768 expect(alias.name, isNotNull); |
| 9763 expect(alias.name.name, 'F'); | 9769 expect(alias.name.name, 'F'); |
| 9764 expect(alias.typeParameters, isNotNull); | 9770 expect(alias.typeParameters, isNotNull); |
| 9765 expect(alias.equals, isNotNull); | 9771 expect(alias.equals, isNotNull); |
| (...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11779 RedirectingConstructorInvocation invocation = | 11785 RedirectingConstructorInvocation invocation = |
| 11780 parser.parseRedirectingConstructorInvocation(false); | 11786 parser.parseRedirectingConstructorInvocation(false); |
| 11781 expectNotNullIfNoErrors(invocation); | 11787 expectNotNullIfNoErrors(invocation); |
| 11782 listener.assertNoErrors(); | 11788 listener.assertNoErrors(); |
| 11783 expect(invocation.argumentList, isNotNull); | 11789 expect(invocation.argumentList, isNotNull); |
| 11784 expect(invocation.constructorName, isNull); | 11790 expect(invocation.constructorName, isNull); |
| 11785 expect(invocation.thisKeyword, isNotNull); | 11791 expect(invocation.thisKeyword, isNotNull); |
| 11786 expect(invocation.period, isNull); | 11792 expect(invocation.period, isNull); |
| 11787 } | 11793 } |
| 11788 | 11794 |
| 11795 @failingTest |
| 11789 void test_parseRelationalExpression_as_functionType_noReturnType() { | 11796 void test_parseRelationalExpression_as_functionType_noReturnType() { |
| 11790 createParser('x as Function(int)'); | 11797 createParser('x as Function(int)'); |
| 11791 Expression expression = parser.parseRelationalExpression(); | 11798 Expression expression = parser.parseRelationalExpression(); |
| 11792 expectNotNullIfNoErrors(expression); | 11799 expectNotNullIfNoErrors(expression); |
| 11793 listener.assertNoErrors(); | 11800 listener.assertNoErrors(); |
| 11794 expect(expression, new isInstanceOf<AsExpression>()); | 11801 expect(expression, new isInstanceOf<AsExpression>()); |
| 11795 AsExpression asExpression = expression; | 11802 AsExpression asExpression = expression; |
| 11796 expect(asExpression.expression, isNotNull); | 11803 expect(asExpression.expression, isNotNull); |
| 11797 expect(asExpression.asOperator, isNotNull); | 11804 expect(asExpression.asOperator, isNotNull); |
| 11798 expect(asExpression.type, new isInstanceOf<GenericFunctionType>()); | 11805 expect(asExpression.type, new isInstanceOf<GenericFunctionType>()); |
| 11799 } | 11806 } |
| 11800 | 11807 |
| 11808 @failingTest |
| 11801 void test_parseRelationalExpression_as_functionType_returnType() { | 11809 void test_parseRelationalExpression_as_functionType_returnType() { |
| 11802 createParser('x as String Function(int)'); | 11810 createParser('x as String Function(int)'); |
| 11803 Expression expression = parser.parseRelationalExpression(); | 11811 Expression expression = parser.parseRelationalExpression(); |
| 11804 expectNotNullIfNoErrors(expression); | 11812 expectNotNullIfNoErrors(expression); |
| 11805 listener.assertNoErrors(); | 11813 listener.assertNoErrors(); |
| 11806 expect(expression, new isInstanceOf<AsExpression>()); | 11814 expect(expression, new isInstanceOf<AsExpression>()); |
| 11807 AsExpression asExpression = expression; | 11815 AsExpression asExpression = expression; |
| 11808 expect(asExpression.expression, isNotNull); | 11816 expect(asExpression.expression, isNotNull); |
| 11809 expect(asExpression.asOperator, isNotNull); | 11817 expect(asExpression.asOperator, isNotNull); |
| 11810 expect(asExpression.type, new isInstanceOf<GenericFunctionType>()); | 11818 expect(asExpression.type, new isInstanceOf<GenericFunctionType>()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11946 void test_parseReturnStatement_value() { | 11954 void test_parseReturnStatement_value() { |
| 11947 createParser('return x;'); | 11955 createParser('return x;'); |
| 11948 ReturnStatement statement = parser.parseReturnStatement(); | 11956 ReturnStatement statement = parser.parseReturnStatement(); |
| 11949 expectNotNullIfNoErrors(statement); | 11957 expectNotNullIfNoErrors(statement); |
| 11950 listener.assertNoErrors(); | 11958 listener.assertNoErrors(); |
| 11951 expect(statement.returnKeyword, isNotNull); | 11959 expect(statement.returnKeyword, isNotNull); |
| 11952 expect(statement.expression, isNotNull); | 11960 expect(statement.expression, isNotNull); |
| 11953 expect(statement.semicolon, isNotNull); | 11961 expect(statement.semicolon, isNotNull); |
| 11954 } | 11962 } |
| 11955 | 11963 |
| 11964 @failingTest |
| 11956 void test_parseReturnType_function() { | 11965 void test_parseReturnType_function() { |
| 11957 createParser('A<B> Function<B>(B)'); | 11966 createParser('A<B> Function<B>(B)'); |
| 11958 GenericFunctionType type = parser.parseReturnType(false); | 11967 GenericFunctionType type = parser.parseReturnType(false); |
| 11959 expectNotNullIfNoErrors(type); | 11968 expectNotNullIfNoErrors(type); |
| 11960 listener.assertNoErrors(); | 11969 listener.assertNoErrors(); |
| 11961 expect(type.returnType, isNotNull); | 11970 expect(type.returnType, isNotNull); |
| 11962 expect(type.typeParameters, isNotNull); | 11971 expect(type.typeParameters, isNotNull); |
| 11963 expect(type.parameters, isNotNull); | 11972 expect(type.parameters, isNotNull); |
| 11964 } | 11973 } |
| 11965 | 11974 |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12872 expectNotNullIfNoErrors(typeAlias); | 12881 expectNotNullIfNoErrors(typeAlias); |
| 12873 listener.assertNoErrors(); | 12882 listener.assertNoErrors(); |
| 12874 expect(typeAlias.typedefKeyword, isNotNull); | 12883 expect(typeAlias.typedefKeyword, isNotNull); |
| 12875 expect(typeAlias.name, isNotNull); | 12884 expect(typeAlias.name, isNotNull); |
| 12876 expect(typeAlias.parameters, isNotNull); | 12885 expect(typeAlias.parameters, isNotNull); |
| 12877 expect(typeAlias.returnType, isNotNull); | 12886 expect(typeAlias.returnType, isNotNull); |
| 12878 expect(typeAlias.semicolon, isNotNull); | 12887 expect(typeAlias.semicolon, isNotNull); |
| 12879 expect(typeAlias.typeParameters, isNull); | 12888 expect(typeAlias.typeParameters, isNull); |
| 12880 } | 12889 } |
| 12881 | 12890 |
| 12891 @failingTest |
| 12882 void test_parseTypeAlias_genericFunction_noParameters() { | 12892 void test_parseTypeAlias_genericFunction_noParameters() { |
| 12883 createParser('typedef F = bool Function();'); | 12893 createParser('typedef F = bool Function();'); |
| 12884 GenericTypeAlias typeAlias = | 12894 GenericTypeAlias typeAlias = |
| 12885 parser.parseTypeAlias(emptyCommentAndMetadata()); | 12895 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 12886 expectNotNullIfNoErrors(typeAlias); | 12896 expectNotNullIfNoErrors(typeAlias); |
| 12887 listener.assertNoErrors(); | 12897 listener.assertNoErrors(); |
| 12888 expect(typeAlias.typedefKeyword, isNotNull); | 12898 expect(typeAlias.typedefKeyword, isNotNull); |
| 12889 expect(typeAlias.name, isNotNull); | 12899 expect(typeAlias.name, isNotNull); |
| 12890 expect(typeAlias.typeParameters, isNull); | 12900 expect(typeAlias.typeParameters, isNull); |
| 12891 expect(typeAlias.semicolon, isNotNull); | 12901 expect(typeAlias.semicolon, isNotNull); |
| 12892 GenericFunctionType functionType = typeAlias.functionType; | 12902 GenericFunctionType functionType = typeAlias.functionType; |
| 12893 expect(functionType, isNotNull); | 12903 expect(functionType, isNotNull); |
| 12894 expect(functionType.parameters, isNotNull); | 12904 expect(functionType.parameters, isNotNull); |
| 12895 expect(functionType.returnType, isNotNull); | 12905 expect(functionType.returnType, isNotNull); |
| 12896 expect(functionType.typeParameters, isNull); | 12906 expect(functionType.typeParameters, isNull); |
| 12897 } | 12907 } |
| 12898 | 12908 |
| 12909 @failingTest |
| 12899 void test_parseTypeAlias_genericFunction_noReturnType() { | 12910 void test_parseTypeAlias_genericFunction_noReturnType() { |
| 12900 createParser('typedef F = Function();'); | 12911 createParser('typedef F = Function();'); |
| 12901 GenericTypeAlias typeAlias = | 12912 GenericTypeAlias typeAlias = |
| 12902 parser.parseTypeAlias(emptyCommentAndMetadata()); | 12913 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 12903 expectNotNullIfNoErrors(typeAlias); | 12914 expectNotNullIfNoErrors(typeAlias); |
| 12904 listener.assertNoErrors(); | 12915 listener.assertNoErrors(); |
| 12905 expect(typeAlias.typedefKeyword, isNotNull); | 12916 expect(typeAlias.typedefKeyword, isNotNull); |
| 12906 expect(typeAlias.name, isNotNull); | 12917 expect(typeAlias.name, isNotNull); |
| 12907 expect(typeAlias.typeParameters, isNull); | 12918 expect(typeAlias.typeParameters, isNull); |
| 12908 expect(typeAlias.semicolon, isNotNull); | 12919 expect(typeAlias.semicolon, isNotNull); |
| 12909 GenericFunctionType functionType = typeAlias.functionType; | 12920 GenericFunctionType functionType = typeAlias.functionType; |
| 12910 expect(functionType, isNotNull); | 12921 expect(functionType, isNotNull); |
| 12911 expect(functionType.parameters, isNotNull); | 12922 expect(functionType.parameters, isNotNull); |
| 12912 expect(functionType.returnType, isNull); | 12923 expect(functionType.returnType, isNull); |
| 12913 expect(functionType.typeParameters, isNull); | 12924 expect(functionType.typeParameters, isNull); |
| 12914 } | 12925 } |
| 12915 | 12926 |
| 12927 @failingTest |
| 12916 void test_parseTypeAlias_genericFunction_parameterizedReturnType() { | 12928 void test_parseTypeAlias_genericFunction_parameterizedReturnType() { |
| 12917 createParser('typedef F = A<B> Function();'); | 12929 createParser('typedef F = A<B> Function();'); |
| 12918 GenericTypeAlias typeAlias = | 12930 GenericTypeAlias typeAlias = |
| 12919 parser.parseTypeAlias(emptyCommentAndMetadata()); | 12931 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 12920 expectNotNullIfNoErrors(typeAlias); | 12932 expectNotNullIfNoErrors(typeAlias); |
| 12921 listener.assertNoErrors(); | 12933 listener.assertNoErrors(); |
| 12922 expect(typeAlias.typedefKeyword, isNotNull); | 12934 expect(typeAlias.typedefKeyword, isNotNull); |
| 12923 expect(typeAlias.name, isNotNull); | 12935 expect(typeAlias.name, isNotNull); |
| 12924 expect(typeAlias.typeParameters, isNull); | 12936 expect(typeAlias.typeParameters, isNull); |
| 12925 expect(typeAlias.semicolon, isNotNull); | 12937 expect(typeAlias.semicolon, isNotNull); |
| 12926 GenericFunctionType functionType = typeAlias.functionType; | 12938 GenericFunctionType functionType = typeAlias.functionType; |
| 12927 expect(functionType, isNotNull); | 12939 expect(functionType, isNotNull); |
| 12928 expect(functionType.parameters, isNotNull); | 12940 expect(functionType.parameters, isNotNull); |
| 12929 expect(functionType.returnType, isNotNull); | 12941 expect(functionType.returnType, isNotNull); |
| 12930 expect(functionType.typeParameters, isNull); | 12942 expect(functionType.typeParameters, isNull); |
| 12931 } | 12943 } |
| 12932 | 12944 |
| 12945 @failingTest |
| 12933 void test_parseTypeAlias_genericFunction_parameters() { | 12946 void test_parseTypeAlias_genericFunction_parameters() { |
| 12934 createParser('typedef F = bool Function(Object value);'); | 12947 createParser('typedef F = bool Function(Object value);'); |
| 12935 GenericTypeAlias typeAlias = | 12948 GenericTypeAlias typeAlias = |
| 12936 parser.parseTypeAlias(emptyCommentAndMetadata()); | 12949 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 12937 expectNotNullIfNoErrors(typeAlias); | 12950 expectNotNullIfNoErrors(typeAlias); |
| 12938 listener.assertNoErrors(); | 12951 listener.assertNoErrors(); |
| 12939 expect(typeAlias.typedefKeyword, isNotNull); | 12952 expect(typeAlias.typedefKeyword, isNotNull); |
| 12940 expect(typeAlias.name, isNotNull); | 12953 expect(typeAlias.name, isNotNull); |
| 12941 expect(typeAlias.typeParameters, isNull); | 12954 expect(typeAlias.typeParameters, isNull); |
| 12942 expect(typeAlias.semicolon, isNotNull); | 12955 expect(typeAlias.semicolon, isNotNull); |
| 12943 GenericFunctionType functionType = typeAlias.functionType; | 12956 GenericFunctionType functionType = typeAlias.functionType; |
| 12944 expect(functionType, isNotNull); | 12957 expect(functionType, isNotNull); |
| 12945 expect(functionType.parameters, isNotNull); | 12958 expect(functionType.parameters, isNotNull); |
| 12946 expect(functionType.returnType, isNotNull); | 12959 expect(functionType.returnType, isNotNull); |
| 12947 expect(functionType.typeParameters, isNull); | 12960 expect(functionType.typeParameters, isNull); |
| 12948 } | 12961 } |
| 12949 | 12962 |
| 12963 @failingTest |
| 12950 void test_parseTypeAlias_genericFunction_typeParameters() { | 12964 void test_parseTypeAlias_genericFunction_typeParameters() { |
| 12951 createParser('typedef F = bool Function<E>();'); | 12965 createParser('typedef F = bool Function<E>();'); |
| 12952 GenericTypeAlias typeAlias = | 12966 GenericTypeAlias typeAlias = |
| 12953 parser.parseTypeAlias(emptyCommentAndMetadata()); | 12967 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 12954 expectNotNullIfNoErrors(typeAlias); | 12968 expectNotNullIfNoErrors(typeAlias); |
| 12955 listener.assertNoErrors(); | 12969 listener.assertNoErrors(); |
| 12956 expect(typeAlias.typedefKeyword, isNotNull); | 12970 expect(typeAlias.typedefKeyword, isNotNull); |
| 12957 expect(typeAlias.name, isNotNull); | 12971 expect(typeAlias.name, isNotNull); |
| 12958 expect(typeAlias.typeParameters, isNull); | 12972 expect(typeAlias.typeParameters, isNull); |
| 12959 expect(typeAlias.semicolon, isNotNull); | 12973 expect(typeAlias.semicolon, isNotNull); |
| 12960 GenericFunctionType functionType = typeAlias.functionType; | 12974 GenericFunctionType functionType = typeAlias.functionType; |
| 12961 expect(functionType, isNotNull); | 12975 expect(functionType, isNotNull); |
| 12962 expect(functionType.parameters, isNotNull); | 12976 expect(functionType.parameters, isNotNull); |
| 12963 expect(functionType.returnType, isNotNull); | 12977 expect(functionType.returnType, isNotNull); |
| 12964 expect(functionType.typeParameters, isNotNull); | 12978 expect(functionType.typeParameters, isNotNull); |
| 12965 } | 12979 } |
| 12966 | 12980 |
| 12981 @failingTest |
| 12967 void test_parseTypeAlias_genericFunction_typeParameters_noParameters() { | 12982 void test_parseTypeAlias_genericFunction_typeParameters_noParameters() { |
| 12968 createParser('typedef F<T> = bool Function();'); | 12983 createParser('typedef F<T> = bool Function();'); |
| 12969 GenericTypeAlias typeAlias = | 12984 GenericTypeAlias typeAlias = |
| 12970 parser.parseTypeAlias(emptyCommentAndMetadata()); | 12985 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 12971 expectNotNullIfNoErrors(typeAlias); | 12986 expectNotNullIfNoErrors(typeAlias); |
| 12972 listener.assertNoErrors(); | 12987 listener.assertNoErrors(); |
| 12973 expect(typeAlias.typedefKeyword, isNotNull); | 12988 expect(typeAlias.typedefKeyword, isNotNull); |
| 12974 expect(typeAlias.name, isNotNull); | 12989 expect(typeAlias.name, isNotNull); |
| 12975 expect(typeAlias.typeParameters, isNotNull); | 12990 expect(typeAlias.typeParameters, isNotNull); |
| 12976 expect(typeAlias.semicolon, isNotNull); | 12991 expect(typeAlias.semicolon, isNotNull); |
| 12977 GenericFunctionType functionType = typeAlias.functionType; | 12992 GenericFunctionType functionType = typeAlias.functionType; |
| 12978 expect(functionType, isNotNull); | 12993 expect(functionType, isNotNull); |
| 12979 expect(functionType.parameters, isNotNull); | 12994 expect(functionType.parameters, isNotNull); |
| 12980 expect(functionType.returnType, isNotNull); | 12995 expect(functionType.returnType, isNotNull); |
| 12981 expect(functionType.typeParameters, isNull); | 12996 expect(functionType.typeParameters, isNull); |
| 12982 } | 12997 } |
| 12983 | 12998 |
| 12999 @failingTest |
| 12984 void test_parseTypeAlias_genericFunction_typeParameters_noReturnType() { | 13000 void test_parseTypeAlias_genericFunction_typeParameters_noReturnType() { |
| 12985 createParser('typedef F<T> = Function();'); | 13001 createParser('typedef F<T> = Function();'); |
| 12986 GenericTypeAlias typeAlias = | 13002 GenericTypeAlias typeAlias = |
| 12987 parser.parseTypeAlias(emptyCommentAndMetadata()); | 13003 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 12988 expectNotNullIfNoErrors(typeAlias); | 13004 expectNotNullIfNoErrors(typeAlias); |
| 12989 listener.assertNoErrors(); | 13005 listener.assertNoErrors(); |
| 12990 expect(typeAlias.typedefKeyword, isNotNull); | 13006 expect(typeAlias.typedefKeyword, isNotNull); |
| 12991 expect(typeAlias.name, isNotNull); | 13007 expect(typeAlias.name, isNotNull); |
| 12992 expect(typeAlias.typeParameters, isNotNull); | 13008 expect(typeAlias.typeParameters, isNotNull); |
| 12993 expect(typeAlias.semicolon, isNotNull); | 13009 expect(typeAlias.semicolon, isNotNull); |
| 12994 GenericFunctionType functionType = typeAlias.functionType; | 13010 GenericFunctionType functionType = typeAlias.functionType; |
| 12995 expect(functionType, isNotNull); | 13011 expect(functionType, isNotNull); |
| 12996 expect(functionType.parameters, isNotNull); | 13012 expect(functionType.parameters, isNotNull); |
| 12997 expect(functionType.returnType, isNull); | 13013 expect(functionType.returnType, isNull); |
| 12998 expect(functionType.typeParameters, isNull); | 13014 expect(functionType.typeParameters, isNull); |
| 12999 } | 13015 } |
| 13000 | 13016 |
| 13017 @failingTest |
| 13001 void | 13018 void |
| 13002 test_parseTypeAlias_genericFunction_typeParameters_parameterizedReturnType
() { | 13019 test_parseTypeAlias_genericFunction_typeParameters_parameterizedReturnType
() { |
| 13003 createParser('typedef F<T> = A<B> Function();'); | 13020 createParser('typedef F<T> = A<B> Function();'); |
| 13004 GenericTypeAlias typeAlias = | 13021 GenericTypeAlias typeAlias = |
| 13005 parser.parseTypeAlias(emptyCommentAndMetadata()); | 13022 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 13006 expectNotNullIfNoErrors(typeAlias); | 13023 expectNotNullIfNoErrors(typeAlias); |
| 13007 listener.assertNoErrors(); | 13024 listener.assertNoErrors(); |
| 13008 expect(typeAlias.typedefKeyword, isNotNull); | 13025 expect(typeAlias.typedefKeyword, isNotNull); |
| 13009 expect(typeAlias.name, isNotNull); | 13026 expect(typeAlias.name, isNotNull); |
| 13010 expect(typeAlias.typeParameters, isNotNull); | 13027 expect(typeAlias.typeParameters, isNotNull); |
| 13011 expect(typeAlias.semicolon, isNotNull); | 13028 expect(typeAlias.semicolon, isNotNull); |
| 13012 GenericFunctionType functionType = typeAlias.functionType; | 13029 GenericFunctionType functionType = typeAlias.functionType; |
| 13013 expect(functionType, isNotNull); | 13030 expect(functionType, isNotNull); |
| 13014 expect(functionType.parameters, isNotNull); | 13031 expect(functionType.parameters, isNotNull); |
| 13015 expect(functionType.returnType, isNotNull); | 13032 expect(functionType.returnType, isNotNull); |
| 13016 expect(functionType.typeParameters, isNull); | 13033 expect(functionType.typeParameters, isNull); |
| 13017 } | 13034 } |
| 13018 | 13035 |
| 13036 @failingTest |
| 13019 void test_parseTypeAlias_genericFunction_typeParameters_parameters() { | 13037 void test_parseTypeAlias_genericFunction_typeParameters_parameters() { |
| 13020 createParser('typedef F<T> = bool Function(Object value);'); | 13038 createParser('typedef F<T> = bool Function(Object value);'); |
| 13021 GenericTypeAlias typeAlias = | 13039 GenericTypeAlias typeAlias = |
| 13022 parser.parseTypeAlias(emptyCommentAndMetadata()); | 13040 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 13023 expectNotNullIfNoErrors(typeAlias); | 13041 expectNotNullIfNoErrors(typeAlias); |
| 13024 listener.assertNoErrors(); | 13042 listener.assertNoErrors(); |
| 13025 expect(typeAlias.typedefKeyword, isNotNull); | 13043 expect(typeAlias.typedefKeyword, isNotNull); |
| 13026 expect(typeAlias.name, isNotNull); | 13044 expect(typeAlias.name, isNotNull); |
| 13027 expect(typeAlias.typeParameters, isNotNull); | 13045 expect(typeAlias.typeParameters, isNotNull); |
| 13028 expect(typeAlias.semicolon, isNotNull); | 13046 expect(typeAlias.semicolon, isNotNull); |
| 13029 GenericFunctionType functionType = typeAlias.functionType; | 13047 GenericFunctionType functionType = typeAlias.functionType; |
| 13030 expect(functionType, isNotNull); | 13048 expect(functionType, isNotNull); |
| 13031 expect(functionType.parameters, isNotNull); | 13049 expect(functionType.parameters, isNotNull); |
| 13032 expect(functionType.returnType, isNotNull); | 13050 expect(functionType.returnType, isNotNull); |
| 13033 expect(functionType.typeParameters, isNull); | 13051 expect(functionType.typeParameters, isNull); |
| 13034 } | 13052 } |
| 13035 | 13053 |
| 13054 @failingTest |
| 13036 void test_parseTypeAlias_genericFunction_typeParameters_typeParameters() { | 13055 void test_parseTypeAlias_genericFunction_typeParameters_typeParameters() { |
| 13037 createParser('typedef F<T> = bool Function<E>();'); | 13056 createParser('typedef F<T> = bool Function<E>();'); |
| 13038 GenericTypeAlias typeAlias = | 13057 GenericTypeAlias typeAlias = |
| 13039 parser.parseTypeAlias(emptyCommentAndMetadata()); | 13058 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 13040 expectNotNullIfNoErrors(typeAlias); | 13059 expectNotNullIfNoErrors(typeAlias); |
| 13041 listener.assertNoErrors(); | 13060 listener.assertNoErrors(); |
| 13042 expect(typeAlias.typedefKeyword, isNotNull); | 13061 expect(typeAlias.typedefKeyword, isNotNull); |
| 13043 expect(typeAlias.name, isNotNull); | 13062 expect(typeAlias.name, isNotNull); |
| 13044 expect(typeAlias.typeParameters, isNotNull); | 13063 expect(typeAlias.typeParameters, isNotNull); |
| 13045 expect(typeAlias.semicolon, isNotNull); | 13064 expect(typeAlias.semicolon, isNotNull); |
| 13046 GenericFunctionType functionType = typeAlias.functionType; | 13065 GenericFunctionType functionType = typeAlias.functionType; |
| 13047 expect(functionType, isNotNull); | 13066 expect(functionType, isNotNull); |
| 13048 expect(functionType.parameters, isNotNull); | 13067 expect(functionType.parameters, isNotNull); |
| 13049 expect(functionType.returnType, isNotNull); | 13068 expect(functionType.returnType, isNotNull); |
| 13050 expect(functionType.typeParameters, isNotNull); | 13069 expect(functionType.typeParameters, isNotNull); |
| 13051 } | 13070 } |
| 13052 | 13071 |
| 13072 @failingTest |
| 13053 void test_parseTypeAlias_genericFunction_typeParameters_voidReturnType() { | 13073 void test_parseTypeAlias_genericFunction_typeParameters_voidReturnType() { |
| 13054 createParser('typedef F<T> = void Function();'); | 13074 createParser('typedef F<T> = void Function();'); |
| 13055 GenericTypeAlias typeAlias = | 13075 GenericTypeAlias typeAlias = |
| 13056 parser.parseTypeAlias(emptyCommentAndMetadata()); | 13076 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 13057 expectNotNullIfNoErrors(typeAlias); | 13077 expectNotNullIfNoErrors(typeAlias); |
| 13058 listener.assertNoErrors(); | 13078 listener.assertNoErrors(); |
| 13059 expect(typeAlias.typedefKeyword, isNotNull); | 13079 expect(typeAlias.typedefKeyword, isNotNull); |
| 13060 expect(typeAlias.name, isNotNull); | 13080 expect(typeAlias.name, isNotNull); |
| 13061 expect(typeAlias.typeParameters, isNotNull); | 13081 expect(typeAlias.typeParameters, isNotNull); |
| 13062 expect(typeAlias.semicolon, isNotNull); | 13082 expect(typeAlias.semicolon, isNotNull); |
| 13063 GenericFunctionType functionType = typeAlias.functionType; | 13083 GenericFunctionType functionType = typeAlias.functionType; |
| 13064 expect(functionType, isNotNull); | 13084 expect(functionType, isNotNull); |
| 13065 expect(functionType.parameters, isNotNull); | 13085 expect(functionType.parameters, isNotNull); |
| 13066 expect(functionType.returnType, isNotNull); | 13086 expect(functionType.returnType, isNotNull); |
| 13067 expect(functionType.typeParameters, isNull); | 13087 expect(functionType.typeParameters, isNull); |
| 13068 } | 13088 } |
| 13069 | 13089 |
| 13090 @failingTest |
| 13070 void test_parseTypeAlias_genericFunction_voidReturnType() { | 13091 void test_parseTypeAlias_genericFunction_voidReturnType() { |
| 13071 createParser('typedef F = void Function();'); | 13092 createParser('typedef F = void Function();'); |
| 13072 GenericTypeAlias typeAlias = | 13093 GenericTypeAlias typeAlias = |
| 13073 parser.parseTypeAlias(emptyCommentAndMetadata()); | 13094 parser.parseTypeAlias(emptyCommentAndMetadata()); |
| 13074 expectNotNullIfNoErrors(typeAlias); | 13095 expectNotNullIfNoErrors(typeAlias); |
| 13075 listener.assertNoErrors(); | 13096 listener.assertNoErrors(); |
| 13076 expect(typeAlias.typedefKeyword, isNotNull); | 13097 expect(typeAlias.typedefKeyword, isNotNull); |
| 13077 expect(typeAlias.name, isNotNull); | 13098 expect(typeAlias.name, isNotNull); |
| 13078 expect(typeAlias.typeParameters, isNull); | 13099 expect(typeAlias.typeParameters, isNull); |
| 13079 expect(typeAlias.semicolon, isNotNull); | 13100 expect(typeAlias.semicolon, isNotNull); |
| 13080 GenericFunctionType functionType = typeAlias.functionType; | 13101 GenericFunctionType functionType = typeAlias.functionType; |
| 13081 expect(functionType, isNotNull); | 13102 expect(functionType, isNotNull); |
| 13082 expect(functionType.parameters, isNotNull); | 13103 expect(functionType.parameters, isNotNull); |
| 13083 expect(functionType.returnType, isNotNull); | 13104 expect(functionType.returnType, isNotNull); |
| 13084 expect(functionType.typeParameters, isNull); | 13105 expect(functionType.typeParameters, isNull); |
| 13085 } | 13106 } |
| 13086 | 13107 |
| 13108 @failingTest |
| 13087 void test_parseTypeAnnotation_function_noReturnType_noParameters() { | 13109 void test_parseTypeAnnotation_function_noReturnType_noParameters() { |
| 13088 createParser('Function() v'); | 13110 createParser('Function() v'); |
| 13089 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13111 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13090 expectNotNullIfNoErrors(functionType); | 13112 expectNotNullIfNoErrors(functionType); |
| 13091 listener.assertNoErrors(); | 13113 listener.assertNoErrors(); |
| 13092 expect(functionType.returnType, isNull); | 13114 expect(functionType.returnType, isNull); |
| 13093 expect(functionType.functionKeyword, isNotNull); | 13115 expect(functionType.functionKeyword, isNotNull); |
| 13094 expect(functionType.typeParameters, isNull); | 13116 expect(functionType.typeParameters, isNull); |
| 13095 FormalParameterList parameterList = functionType.parameters; | 13117 FormalParameterList parameterList = functionType.parameters; |
| 13096 expect(parameterList, isNotNull); | 13118 expect(parameterList, isNotNull); |
| 13097 expect(parameterList.parameters, hasLength(0)); | 13119 expect(parameterList.parameters, hasLength(0)); |
| 13098 } | 13120 } |
| 13099 | 13121 |
| 13122 @failingTest |
| 13100 void test_parseTypeAnnotation_function_noReturnType_parameters() { | 13123 void test_parseTypeAnnotation_function_noReturnType_parameters() { |
| 13101 createParser('Function(int, int) v'); | 13124 createParser('Function(int, int) v'); |
| 13102 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13125 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13103 expectNotNullIfNoErrors(functionType); | 13126 expectNotNullIfNoErrors(functionType); |
| 13104 listener.assertNoErrors(); | 13127 listener.assertNoErrors(); |
| 13105 expect(functionType.returnType, isNull); | 13128 expect(functionType.returnType, isNull); |
| 13106 expect(functionType.functionKeyword, isNotNull); | 13129 expect(functionType.functionKeyword, isNotNull); |
| 13107 expect(functionType.typeParameters, isNull); | 13130 expect(functionType.typeParameters, isNull); |
| 13108 FormalParameterList parameterList = functionType.parameters; | 13131 FormalParameterList parameterList = functionType.parameters; |
| 13109 expect(parameterList, isNotNull); | 13132 expect(parameterList, isNotNull); |
| 13110 NodeList<FormalParameter> parameters = parameterList.parameters; | 13133 NodeList<FormalParameter> parameters = parameterList.parameters; |
| 13111 expect(parameters, hasLength(2)); | 13134 expect(parameters, hasLength(2)); |
| 13112 | 13135 |
| 13113 expect(parameters[0], new isInstanceOf<SimpleFormalParameter>()); | 13136 expect(parameters[0], new isInstanceOf<SimpleFormalParameter>()); |
| 13114 SimpleFormalParameter parameter = parameters[0]; | 13137 SimpleFormalParameter parameter = parameters[0]; |
| 13115 expect(parameter.identifier, isNull); | 13138 expect(parameter.identifier, isNull); |
| 13116 expect(parameter.type, new isInstanceOf<TypeName>()); | 13139 expect(parameter.type, new isInstanceOf<TypeName>()); |
| 13117 expect((parameter.type as TypeName).name.name, 'int'); | 13140 expect((parameter.type as TypeName).name.name, 'int'); |
| 13118 | 13141 |
| 13119 expect(parameters[1], new isInstanceOf<SimpleFormalParameter>()); | 13142 expect(parameters[1], new isInstanceOf<SimpleFormalParameter>()); |
| 13120 parameter = parameters[1]; | 13143 parameter = parameters[1]; |
| 13121 expect(parameter.identifier, isNull); | 13144 expect(parameter.identifier, isNull); |
| 13122 expect(parameter.type, new isInstanceOf<TypeName>()); | 13145 expect(parameter.type, new isInstanceOf<TypeName>()); |
| 13123 expect((parameter.type as TypeName).name.name, 'int'); | 13146 expect((parameter.type as TypeName).name.name, 'int'); |
| 13124 } | 13147 } |
| 13125 | 13148 |
| 13149 @failingTest |
| 13126 void test_parseTypeAnnotation_function_noReturnType_typeParameters() { | 13150 void test_parseTypeAnnotation_function_noReturnType_typeParameters() { |
| 13127 createParser('Function<S, T>()'); | 13151 createParser('Function<S, T>()'); |
| 13128 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13152 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13129 expectNotNullIfNoErrors(functionType); | 13153 expectNotNullIfNoErrors(functionType); |
| 13130 listener.assertNoErrors(); | 13154 listener.assertNoErrors(); |
| 13131 expect(functionType.returnType, isNull); | 13155 expect(functionType.returnType, isNull); |
| 13132 expect(functionType.functionKeyword, isNotNull); | 13156 expect(functionType.functionKeyword, isNotNull); |
| 13133 TypeParameterList typeParameters = functionType.typeParameters; | 13157 TypeParameterList typeParameters = functionType.typeParameters; |
| 13134 expect(typeParameters, isNotNull); | 13158 expect(typeParameters, isNotNull); |
| 13135 expect(typeParameters.typeParameters, hasLength(2)); | 13159 expect(typeParameters.typeParameters, hasLength(2)); |
| 13136 FormalParameterList parameterList = functionType.parameters; | 13160 FormalParameterList parameterList = functionType.parameters; |
| 13137 expect(parameterList, isNotNull); | 13161 expect(parameterList, isNotNull); |
| 13138 expect(parameterList.parameters, hasLength(0)); | 13162 expect(parameterList.parameters, hasLength(0)); |
| 13139 } | 13163 } |
| 13140 | 13164 |
| 13165 @failingTest |
| 13141 void | 13166 void |
| 13142 test_parseTypeAnnotation_function_noReturnType_typeParameters_parameters()
{ | 13167 test_parseTypeAnnotation_function_noReturnType_typeParameters_parameters()
{ |
| 13143 createParser('Function<T>(String, {T t})'); | 13168 createParser('Function<T>(String, {T t})'); |
| 13144 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13169 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13145 expectNotNullIfNoErrors(functionType); | 13170 expectNotNullIfNoErrors(functionType); |
| 13146 listener.assertNoErrors(); | 13171 listener.assertNoErrors(); |
| 13147 expect(functionType.returnType, isNull); | 13172 expect(functionType.returnType, isNull); |
| 13148 expect(functionType.functionKeyword, isNotNull); | 13173 expect(functionType.functionKeyword, isNotNull); |
| 13149 TypeParameterList typeParameters = functionType.typeParameters; | 13174 TypeParameterList typeParameters = functionType.typeParameters; |
| 13150 expect(typeParameters, isNotNull); | 13175 expect(typeParameters, isNotNull); |
| 13151 expect(typeParameters.typeParameters, hasLength(1)); | 13176 expect(typeParameters.typeParameters, hasLength(1)); |
| 13152 FormalParameterList parameterList = functionType.parameters; | 13177 FormalParameterList parameterList = functionType.parameters; |
| 13153 expect(parameterList, isNotNull); | 13178 expect(parameterList, isNotNull); |
| 13154 expect(parameterList.parameters, hasLength(2)); | 13179 expect(parameterList.parameters, hasLength(2)); |
| 13155 } | 13180 } |
| 13156 | 13181 |
| 13157 void test_parseTypeAnnotation_function_returnType_classFunction() { | 13182 void test_parseTypeAnnotation_function_returnType_classFunction() { |
| 13158 createParser('Function v'); | 13183 createParser('Function v'); |
| 13159 TypeName functionType = parser.parseTypeAnnotation(false); | 13184 TypeName functionType = parser.parseTypeAnnotation(false); |
| 13160 expectNotNullIfNoErrors(functionType); | 13185 expectNotNullIfNoErrors(functionType); |
| 13161 listener.assertNoErrors(); | 13186 listener.assertNoErrors(); |
| 13162 } | 13187 } |
| 13163 | 13188 |
| 13189 @failingTest |
| 13164 void test_parseTypeAnnotation_function_returnType_function() { | 13190 void test_parseTypeAnnotation_function_returnType_function() { |
| 13165 createParser('A Function(B, C) Function(D) v'); | 13191 createParser('A Function(B, C) Function(D) v'); |
| 13166 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13192 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13167 expectNotNullIfNoErrors(functionType); | 13193 expectNotNullIfNoErrors(functionType); |
| 13168 listener.assertNoErrors(); | 13194 listener.assertNoErrors(); |
| 13169 } | 13195 } |
| 13170 | 13196 |
| 13197 @failingTest |
| 13171 void test_parseTypeAnnotation_function_returnType_noParameters() { | 13198 void test_parseTypeAnnotation_function_returnType_noParameters() { |
| 13172 createParser('List<int> Function()'); | 13199 createParser('List<int> Function()'); |
| 13173 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13200 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13174 expectNotNullIfNoErrors(functionType); | 13201 expectNotNullIfNoErrors(functionType); |
| 13175 listener.assertNoErrors(); | 13202 listener.assertNoErrors(); |
| 13176 expect(functionType.returnType, isNotNull); | 13203 expect(functionType.returnType, isNotNull); |
| 13177 expect(functionType.functionKeyword, isNotNull); | 13204 expect(functionType.functionKeyword, isNotNull); |
| 13178 expect(functionType.typeParameters, isNull); | 13205 expect(functionType.typeParameters, isNull); |
| 13179 FormalParameterList parameterList = functionType.parameters; | 13206 FormalParameterList parameterList = functionType.parameters; |
| 13180 expect(parameterList, isNotNull); | 13207 expect(parameterList, isNotNull); |
| 13181 expect(parameterList.parameters, hasLength(0)); | 13208 expect(parameterList.parameters, hasLength(0)); |
| 13182 } | 13209 } |
| 13183 | 13210 |
| 13211 @failingTest |
| 13184 void test_parseTypeAnnotation_function_returnType_parameters() { | 13212 void test_parseTypeAnnotation_function_returnType_parameters() { |
| 13185 createParser('List<int> Function(String s, int i)'); | 13213 createParser('List<int> Function(String s, int i)'); |
| 13186 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13214 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13187 expectNotNullIfNoErrors(functionType); | 13215 expectNotNullIfNoErrors(functionType); |
| 13188 listener.assertNoErrors(); | 13216 listener.assertNoErrors(); |
| 13189 expect(functionType.returnType, isNotNull); | 13217 expect(functionType.returnType, isNotNull); |
| 13190 expect(functionType.functionKeyword, isNotNull); | 13218 expect(functionType.functionKeyword, isNotNull); |
| 13191 expect(functionType.typeParameters, isNull); | 13219 expect(functionType.typeParameters, isNull); |
| 13192 FormalParameterList parameterList = functionType.parameters; | 13220 FormalParameterList parameterList = functionType.parameters; |
| 13193 expect(parameterList, isNotNull); | 13221 expect(parameterList, isNotNull); |
| 13194 NodeList<FormalParameter> parameters = parameterList.parameters; | 13222 NodeList<FormalParameter> parameters = parameterList.parameters; |
| 13195 expect(parameters, hasLength(2)); | 13223 expect(parameters, hasLength(2)); |
| 13196 | 13224 |
| 13197 expect(parameters[0], new isInstanceOf<SimpleFormalParameter>()); | 13225 expect(parameters[0], new isInstanceOf<SimpleFormalParameter>()); |
| 13198 SimpleFormalParameter parameter = parameters[0]; | 13226 SimpleFormalParameter parameter = parameters[0]; |
| 13199 expect(parameter.identifier, isNotNull); | 13227 expect(parameter.identifier, isNotNull); |
| 13200 expect(parameter.identifier.name, 's'); | 13228 expect(parameter.identifier.name, 's'); |
| 13201 expect(parameter.type, new isInstanceOf<TypeName>()); | 13229 expect(parameter.type, new isInstanceOf<TypeName>()); |
| 13202 expect((parameter.type as TypeName).name.name, 'String'); | 13230 expect((parameter.type as TypeName).name.name, 'String'); |
| 13203 | 13231 |
| 13204 expect(parameters[1], new isInstanceOf<SimpleFormalParameter>()); | 13232 expect(parameters[1], new isInstanceOf<SimpleFormalParameter>()); |
| 13205 parameter = parameters[1]; | 13233 parameter = parameters[1]; |
| 13206 expect(parameter.identifier, isNotNull); | 13234 expect(parameter.identifier, isNotNull); |
| 13207 expect(parameter.identifier.name, 'i'); | 13235 expect(parameter.identifier.name, 'i'); |
| 13208 expect(parameter.type, new isInstanceOf<TypeName>()); | 13236 expect(parameter.type, new isInstanceOf<TypeName>()); |
| 13209 expect((parameter.type as TypeName).name.name, 'int'); | 13237 expect((parameter.type as TypeName).name.name, 'int'); |
| 13210 } | 13238 } |
| 13211 | 13239 |
| 13240 @failingTest |
| 13212 void test_parseTypeAnnotation_function_returnType_simple() { | 13241 void test_parseTypeAnnotation_function_returnType_simple() { |
| 13213 createParser('A Function(B, C) v'); | 13242 createParser('A Function(B, C) v'); |
| 13214 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13243 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13215 expectNotNullIfNoErrors(functionType); | 13244 expectNotNullIfNoErrors(functionType); |
| 13216 listener.assertNoErrors(); | 13245 listener.assertNoErrors(); |
| 13217 } | 13246 } |
| 13218 | 13247 |
| 13248 @failingTest |
| 13219 void test_parseTypeAnnotation_function_returnType_typeParameters() { | 13249 void test_parseTypeAnnotation_function_returnType_typeParameters() { |
| 13220 createParser('List<T> Function<T>()'); | 13250 createParser('List<T> Function<T>()'); |
| 13221 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13251 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13222 expectNotNullIfNoErrors(functionType); | 13252 expectNotNullIfNoErrors(functionType); |
| 13223 listener.assertNoErrors(); | 13253 listener.assertNoErrors(); |
| 13224 expect(functionType.returnType, isNotNull); | 13254 expect(functionType.returnType, isNotNull); |
| 13225 expect(functionType.functionKeyword, isNotNull); | 13255 expect(functionType.functionKeyword, isNotNull); |
| 13226 TypeParameterList typeParameters = functionType.typeParameters; | 13256 TypeParameterList typeParameters = functionType.typeParameters; |
| 13227 expect(typeParameters, isNotNull); | 13257 expect(typeParameters, isNotNull); |
| 13228 expect(typeParameters.typeParameters, hasLength(1)); | 13258 expect(typeParameters.typeParameters, hasLength(1)); |
| 13229 FormalParameterList parameterList = functionType.parameters; | 13259 FormalParameterList parameterList = functionType.parameters; |
| 13230 expect(parameterList, isNotNull); | 13260 expect(parameterList, isNotNull); |
| 13231 expect(parameterList.parameters, hasLength(0)); | 13261 expect(parameterList.parameters, hasLength(0)); |
| 13232 } | 13262 } |
| 13233 | 13263 |
| 13264 @failingTest |
| 13234 void | 13265 void |
| 13235 test_parseTypeAnnotation_function_returnType_typeParameters_parameters() { | 13266 test_parseTypeAnnotation_function_returnType_typeParameters_parameters() { |
| 13236 createParser('List<T> Function<T>(String s, [T])'); | 13267 createParser('List<T> Function<T>(String s, [T])'); |
| 13237 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13268 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13238 expectNotNullIfNoErrors(functionType); | 13269 expectNotNullIfNoErrors(functionType); |
| 13239 listener.assertNoErrors(); | 13270 listener.assertNoErrors(); |
| 13240 expect(functionType.returnType, isNotNull); | 13271 expect(functionType.returnType, isNotNull); |
| 13241 expect(functionType.functionKeyword, isNotNull); | 13272 expect(functionType.functionKeyword, isNotNull); |
| 13242 TypeParameterList typeParameters = functionType.typeParameters; | 13273 TypeParameterList typeParameters = functionType.typeParameters; |
| 13243 expect(typeParameters, isNotNull); | 13274 expect(typeParameters, isNotNull); |
| 13244 expect(typeParameters.typeParameters, hasLength(1)); | 13275 expect(typeParameters.typeParameters, hasLength(1)); |
| 13245 FormalParameterList parameterList = functionType.parameters; | 13276 FormalParameterList parameterList = functionType.parameters; |
| 13246 expect(parameterList, isNotNull); | 13277 expect(parameterList, isNotNull); |
| 13247 expect(parameterList.parameters, hasLength(2)); | 13278 expect(parameterList.parameters, hasLength(2)); |
| 13248 } | 13279 } |
| 13249 | 13280 |
| 13281 @failingTest |
| 13250 void test_parseTypeAnnotation_function_returnType_withArguments() { | 13282 void test_parseTypeAnnotation_function_returnType_withArguments() { |
| 13251 createParser('A<B> Function(C) v'); | 13283 createParser('A<B> Function(C) v'); |
| 13252 GenericFunctionType functionType = parser.parseTypeAnnotation(false); | 13284 GenericFunctionType functionType = parser.parseTypeAnnotation(false); |
| 13253 expectNotNullIfNoErrors(functionType); | 13285 expectNotNullIfNoErrors(functionType); |
| 13254 listener.assertNoErrors(); | 13286 listener.assertNoErrors(); |
| 13255 } | 13287 } |
| 13256 | 13288 |
| 13257 void test_parseTypeAnnotation_named() { | 13289 void test_parseTypeAnnotation_named() { |
| 13258 createParser('A<B> v'); | 13290 createParser('A<B> v'); |
| 13259 TypeName typeName = parser.parseTypeAnnotation(false); | 13291 TypeName typeName = parser.parseTypeAnnotation(false); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13390 enableNnbd = true; | 13422 enableNnbd = true; |
| 13391 createParser('String?'); | 13423 createParser('String?'); |
| 13392 TypeName typeName = parser.parseTypeName(false); | 13424 TypeName typeName = parser.parseTypeName(false); |
| 13393 expectNotNullIfNoErrors(typeName); | 13425 expectNotNullIfNoErrors(typeName); |
| 13394 listener.assertNoErrors(); | 13426 listener.assertNoErrors(); |
| 13395 expect(typeName.name, isNotNull); | 13427 expect(typeName.name, isNotNull); |
| 13396 expect(typeName.typeArguments, isNull); | 13428 expect(typeName.typeArguments, isNull); |
| 13397 expect(typeName.question, isNotNull); | 13429 expect(typeName.question, isNotNull); |
| 13398 } | 13430 } |
| 13399 | 13431 |
| 13432 @failingTest |
| 13400 void test_parseTypeParameter_bounded_functionType_noReturn() { | 13433 void test_parseTypeParameter_bounded_functionType_noReturn() { |
| 13401 createParser('A extends Function(int)'); | 13434 createParser('A extends Function(int)'); |
| 13402 TypeParameter parameter = parser.parseTypeParameter(); | 13435 TypeParameter parameter = parser.parseTypeParameter(); |
| 13403 expectNotNullIfNoErrors(parameter); | 13436 expectNotNullIfNoErrors(parameter); |
| 13404 listener.assertNoErrors(); | 13437 listener.assertNoErrors(); |
| 13405 expect(parameter.bound, new isInstanceOf<GenericFunctionType>()); | 13438 expect(parameter.bound, new isInstanceOf<GenericFunctionType>()); |
| 13406 expect(parameter.extendsKeyword, isNotNull); | 13439 expect(parameter.extendsKeyword, isNotNull); |
| 13407 expect(parameter.name, isNotNull); | 13440 expect(parameter.name, isNotNull); |
| 13408 } | 13441 } |
| 13409 | 13442 |
| 13443 @failingTest |
| 13410 void test_parseTypeParameter_bounded_functionType_return() { | 13444 void test_parseTypeParameter_bounded_functionType_return() { |
| 13411 createParser('A extends String Function(int)'); | 13445 createParser('A extends String Function(int)'); |
| 13412 TypeParameter parameter = parser.parseTypeParameter(); | 13446 TypeParameter parameter = parser.parseTypeParameter(); |
| 13413 expectNotNullIfNoErrors(parameter); | 13447 expectNotNullIfNoErrors(parameter); |
| 13414 listener.assertNoErrors(); | 13448 listener.assertNoErrors(); |
| 13415 expect(parameter.bound, new isInstanceOf<GenericFunctionType>()); | 13449 expect(parameter.bound, new isInstanceOf<GenericFunctionType>()); |
| 13416 expect(parameter.extendsKeyword, isNotNull); | 13450 expect(parameter.extendsKeyword, isNotNull); |
| 13417 expect(parameter.name, isNotNull); | 13451 expect(parameter.name, isNotNull); |
| 13418 } | 13452 } |
| 13419 | 13453 |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14112 CompilationUnit _parseDirectives(String source, | 14146 CompilationUnit _parseDirectives(String source, |
| 14113 [List<ErrorCode> errorCodes = const <ErrorCode>[]]) { | 14147 [List<ErrorCode> errorCodes = const <ErrorCode>[]]) { |
| 14114 createParser(source); | 14148 createParser(source); |
| 14115 CompilationUnit unit = parser.parseDirectives2(); | 14149 CompilationUnit unit = parser.parseDirectives2(); |
| 14116 expect(unit, isNotNull); | 14150 expect(unit, isNotNull); |
| 14117 expect(unit.declarations, hasLength(0)); | 14151 expect(unit.declarations, hasLength(0)); |
| 14118 listener.assertErrorsWithCodes(errorCodes); | 14152 listener.assertErrorsWithCodes(errorCodes); |
| 14119 return unit; | 14153 return unit; |
| 14120 } | 14154 } |
| 14121 } | 14155 } |
| OLD | NEW |