| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 /** | 76 /** |
| 77 * Prepares to parse using tokens scanned from the given [content] string. | 77 * Prepares to parse using tokens scanned from the given [content] string. |
| 78 */ | 78 */ |
| 79 void createParser(String content); | 79 void createParser(String content); |
| 80 | 80 |
| 81 Expression parseAdditiveExpression(String code); | 81 Expression parseAdditiveExpression(String code); |
| 82 | 82 |
| 83 Expression parseAssignableExpression(String code, bool primaryAllowed); | 83 Expression parseAssignableExpression(String code, bool primaryAllowed); |
| 84 | 84 |
| 85 Expression parseAssignableSelector( | 85 Expression parseAssignableSelector(String code, bool optional, |
| 86 String code, bool optional, | |
| 87 {bool allowConditional: true}); | 86 {bool allowConditional: true}); |
| 88 | 87 |
| 89 AwaitExpression parseAwaitExpression(String code); | 88 AwaitExpression parseAwaitExpression(String code); |
| 90 | 89 |
| 91 Expression parseBitwiseAndExpression(String code); | 90 Expression parseBitwiseAndExpression(String code); |
| 92 | 91 |
| 93 Expression parseBitwiseOrExpression(String code); | 92 Expression parseBitwiseOrExpression(String code); |
| 94 | 93 |
| 95 Expression parseBitwiseXorExpression(String code); | 94 Expression parseBitwiseXorExpression(String code); |
| 96 | 95 |
| (...skipping 3953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4050 expect(invocation.function, isNotNull); | 4049 expect(invocation.function, isNotNull); |
| 4051 expect(invocation.typeArguments, isNull); | 4050 expect(invocation.typeArguments, isNull); |
| 4052 ArgumentList argumentList = invocation.argumentList; | 4051 ArgumentList argumentList = invocation.argumentList; |
| 4053 expect(argumentList, isNotNull); | 4052 expect(argumentList, isNotNull); |
| 4054 expect(argumentList.arguments, hasLength(1)); | 4053 expect(argumentList.arguments, hasLength(1)); |
| 4055 expect(propertyAccess.operator, isNotNull); | 4054 expect(propertyAccess.operator, isNotNull); |
| 4056 expect(propertyAccess.propertyName, isNotNull); | 4055 expect(propertyAccess.propertyName, isNotNull); |
| 4057 } | 4056 } |
| 4058 | 4057 |
| 4059 void | 4058 void |
| 4060 test_parseAssignableExpression_expression_args_dot_typeParameterComments()
{ | 4059 test_parseAssignableExpression_expression_args_dot_typeArgumentComments()
{ |
| 4061 enableGenericMethodComments = true; | 4060 enableGenericMethodComments = true; |
| 4062 Expression expression = parseAssignableExpression('(x)/*<F>*/(y).z', false); | 4061 Expression expression = parseAssignableExpression('(x)/*<F>*/(y).z', false); |
| 4063 expect(expression, isNotNull); | 4062 expect(expression, isNotNull); |
| 4064 assertNoErrors(); | 4063 assertNoErrors(); |
| 4065 var propertyAccess = expression as PropertyAccess; | 4064 var propertyAccess = expression as PropertyAccess; |
| 4066 FunctionExpressionInvocation invocation = | 4065 FunctionExpressionInvocation invocation = |
| 4067 propertyAccess.target as FunctionExpressionInvocation; | 4066 propertyAccess.target as FunctionExpressionInvocation; |
| 4068 expect(invocation.function, isNotNull); | 4067 expect(invocation.function, isNotNull); |
| 4069 expect(invocation.typeArguments, isNotNull); | 4068 expect(invocation.typeArguments, isNotNull); |
| 4070 ArgumentList argumentList = invocation.argumentList; | 4069 ArgumentList argumentList = invocation.argumentList; |
| 4071 expect(argumentList, isNotNull); | 4070 expect(argumentList, isNotNull); |
| 4072 expect(argumentList.arguments, hasLength(1)); | 4071 expect(argumentList.arguments, hasLength(1)); |
| 4073 expect(propertyAccess.operator, isNotNull); | 4072 expect(propertyAccess.operator, isNotNull); |
| 4074 expect(propertyAccess.propertyName, isNotNull); | 4073 expect(propertyAccess.propertyName, isNotNull); |
| 4075 } | 4074 } |
| 4076 | 4075 |
| 4077 void test_parseAssignableExpression_expression_args_dot_typeParameters() { | 4076 void test_parseAssignableExpression_expression_args_dot_typeArguments() { |
| 4078 Expression expression = parseAssignableExpression('(x)<F>(y).z', false); | 4077 Expression expression = parseAssignableExpression('(x)<F>(y).z', false); |
| 4079 expect(expression, isNotNull); | 4078 expect(expression, isNotNull); |
| 4080 assertNoErrors(); | 4079 assertNoErrors(); |
| 4081 var propertyAccess = expression as PropertyAccess; | 4080 var propertyAccess = expression as PropertyAccess; |
| 4082 FunctionExpressionInvocation invocation = | 4081 FunctionExpressionInvocation invocation = |
| 4083 propertyAccess.target as FunctionExpressionInvocation; | 4082 propertyAccess.target as FunctionExpressionInvocation; |
| 4084 expect(invocation.function, isNotNull); | 4083 expect(invocation.function, isNotNull); |
| 4085 expect(invocation.typeArguments, isNotNull); | 4084 expect(invocation.typeArguments, isNotNull); |
| 4086 ArgumentList argumentList = invocation.argumentList; | 4085 ArgumentList argumentList = invocation.argumentList; |
| 4087 expect(argumentList, isNotNull); | 4086 expect(argumentList, isNotNull); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4138 expect(invocation.methodName.name, "x"); | 4137 expect(invocation.methodName.name, "x"); |
| 4139 expect(invocation.typeArguments, isNull); | 4138 expect(invocation.typeArguments, isNull); |
| 4140 ArgumentList argumentList = invocation.argumentList; | 4139 ArgumentList argumentList = invocation.argumentList; |
| 4141 expect(argumentList, isNotNull); | 4140 expect(argumentList, isNotNull); |
| 4142 expect(argumentList.arguments, hasLength(1)); | 4141 expect(argumentList.arguments, hasLength(1)); |
| 4143 expect(propertyAccess.operator, isNotNull); | 4142 expect(propertyAccess.operator, isNotNull); |
| 4144 expect(propertyAccess.propertyName, isNotNull); | 4143 expect(propertyAccess.propertyName, isNotNull); |
| 4145 } | 4144 } |
| 4146 | 4145 |
| 4147 void | 4146 void |
| 4148 test_parseAssignableExpression_identifier_args_dot_typeParameterComments()
{ | 4147 test_parseAssignableExpression_identifier_args_dot_typeArgumentComments()
{ |
| 4149 enableGenericMethodComments = true; | 4148 enableGenericMethodComments = true; |
| 4150 Expression expression = parseAssignableExpression('x/*<E>*/(y).z', false); | 4149 Expression expression = parseAssignableExpression('x/*<E>*/(y).z', false); |
| 4151 expect(expression, isNotNull); | 4150 expect(expression, isNotNull); |
| 4152 assertNoErrors(); | 4151 assertNoErrors(); |
| 4153 var propertyAccess = expression as PropertyAccess; | 4152 var propertyAccess = expression as PropertyAccess; |
| 4154 MethodInvocation invocation = propertyAccess.target as MethodInvocation; | 4153 MethodInvocation invocation = propertyAccess.target as MethodInvocation; |
| 4155 expect(invocation.methodName.name, "x"); | 4154 expect(invocation.methodName.name, "x"); |
| 4156 expect(invocation.typeArguments, isNotNull); | 4155 expect(invocation.typeArguments, isNotNull); |
| 4157 ArgumentList argumentList = invocation.argumentList; | 4156 ArgumentList argumentList = invocation.argumentList; |
| 4158 expect(argumentList, isNotNull); | 4157 expect(argumentList, isNotNull); |
| 4159 expect(argumentList.arguments, hasLength(1)); | 4158 expect(argumentList.arguments, hasLength(1)); |
| 4160 expect(propertyAccess.operator, isNotNull); | 4159 expect(propertyAccess.operator, isNotNull); |
| 4161 expect(propertyAccess.propertyName, isNotNull); | 4160 expect(propertyAccess.propertyName, isNotNull); |
| 4162 } | 4161 } |
| 4163 | 4162 |
| 4164 void test_parseAssignableExpression_identifier_args_dot_typeParameters() { | 4163 void test_parseAssignableExpression_identifier_args_dot_typeArguments() { |
| 4165 Expression expression = parseAssignableExpression('x<E>(y).z', false); | 4164 Expression expression = parseAssignableExpression('x<E>(y).z', false); |
| 4166 expect(expression, isNotNull); | 4165 expect(expression, isNotNull); |
| 4167 assertNoErrors(); | 4166 assertNoErrors(); |
| 4168 var propertyAccess = expression as PropertyAccess; | 4167 var propertyAccess = expression as PropertyAccess; |
| 4169 MethodInvocation invocation = propertyAccess.target as MethodInvocation; | 4168 MethodInvocation invocation = propertyAccess.target as MethodInvocation; |
| 4170 expect(invocation.methodName.name, "x"); | 4169 expect(invocation.methodName.name, "x"); |
| 4171 expect(invocation.typeArguments, isNotNull); | 4170 expect(invocation.typeArguments, isNotNull); |
| 4172 ArgumentList argumentList = invocation.argumentList; | 4171 ArgumentList argumentList = invocation.argumentList; |
| 4173 expect(argumentList, isNotNull); | 4172 expect(argumentList, isNotNull); |
| 4174 expect(argumentList.arguments, hasLength(1)); | 4173 expect(argumentList.arguments, hasLength(1)); |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4998 expect(name, isNotNull); | 4997 expect(name, isNotNull); |
| 4999 TypeName type = name.type; | 4998 TypeName type = name.type; |
| 5000 expect(type, isNotNull); | 4999 expect(type, isNotNull); |
| 5001 expect(type.typeArguments, isNull); | 5000 expect(type.typeArguments, isNull); |
| 5002 expect(name.period, isNotNull); | 5001 expect(name.period, isNotNull); |
| 5003 expect(name.name, isNotNull); | 5002 expect(name.name, isNotNull); |
| 5004 expect(expression.argumentList, isNotNull); | 5003 expect(expression.argumentList, isNotNull); |
| 5005 } | 5004 } |
| 5006 | 5005 |
| 5007 void | 5006 void |
| 5008 test_parseInstanceCreationExpression_qualifiedType_named_typeParameterComm
ent() { | 5007 test_parseInstanceCreationExpression_qualifiedType_named_typeArgumentComme
nts() { |
| 5009 enableGenericMethodComments = true; | 5008 enableGenericMethodComments = true; |
| 5010 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); | 5009 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); |
| 5011 InstanceCreationExpression expression = | 5010 InstanceCreationExpression expression = |
| 5012 parseInstanceCreationExpression('A.B/*<E>*/.c()', token); | 5011 parseInstanceCreationExpression('A.B/*<E>*/.c()', token); |
| 5013 expect(expression, isNotNull); | 5012 expect(expression, isNotNull); |
| 5014 assertNoErrors(); | 5013 assertNoErrors(); |
| 5015 expect(expression.keyword.keyword, Keyword.NEW); | 5014 expect(expression.keyword.keyword, Keyword.NEW); |
| 5016 ConstructorName name = expression.constructorName; | 5015 ConstructorName name = expression.constructorName; |
| 5017 expect(name, isNotNull); | 5016 expect(name, isNotNull); |
| 5018 TypeName type = name.type; | 5017 TypeName type = name.type; |
| 5019 expect(type, isNotNull); | 5018 expect(type, isNotNull); |
| 5020 expect(type.typeArguments.arguments, hasLength(1)); | 5019 expect(type.typeArguments.arguments, hasLength(1)); |
| 5021 expect(name.period, isNotNull); | 5020 expect(name.period, isNotNull); |
| 5022 expect(name.name, isNotNull); | 5021 expect(name.name, isNotNull); |
| 5023 expect(expression.argumentList, isNotNull); | 5022 expect(expression.argumentList, isNotNull); |
| 5024 } | 5023 } |
| 5025 | 5024 |
| 5026 void | 5025 void |
| 5027 test_parseInstanceCreationExpression_qualifiedType_named_typeParameters()
{ | 5026 test_parseInstanceCreationExpression_qualifiedType_named_typeArguments() { |
| 5028 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); | 5027 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); |
| 5029 InstanceCreationExpression expression = | 5028 InstanceCreationExpression expression = |
| 5030 parseInstanceCreationExpression('A.B<E>.c()', token); | 5029 parseInstanceCreationExpression('A.B<E>.c()', token); |
| 5031 expect(expression, isNotNull); | 5030 expect(expression, isNotNull); |
| 5032 assertNoErrors(); | 5031 assertNoErrors(); |
| 5033 expect(expression.keyword.keyword, Keyword.NEW); | 5032 expect(expression.keyword.keyword, Keyword.NEW); |
| 5034 ConstructorName name = expression.constructorName; | 5033 ConstructorName name = expression.constructorName; |
| 5035 expect(name, isNotNull); | 5034 expect(name, isNotNull); |
| 5036 TypeName type = name.type; | 5035 TypeName type = name.type; |
| 5037 expect(type, isNotNull); | 5036 expect(type, isNotNull); |
| 5038 expect(type.typeArguments.arguments, hasLength(1)); | 5037 expect(type.typeArguments.arguments, hasLength(1)); |
| 5039 expect(name.period, isNotNull); | 5038 expect(name.period, isNotNull); |
| 5040 expect(name.name, isNotNull); | 5039 expect(name.name, isNotNull); |
| 5041 expect(expression.argumentList, isNotNull); | 5040 expect(expression.argumentList, isNotNull); |
| 5042 } | 5041 } |
| 5043 | 5042 |
| 5044 void | 5043 void |
| 5045 test_parseInstanceCreationExpression_qualifiedType_typeParameterComment()
{ | 5044 test_parseInstanceCreationExpression_qualifiedType_typeArgumentComments()
{ |
| 5046 enableGenericMethodComments = true; | 5045 enableGenericMethodComments = true; |
| 5047 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); | 5046 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); |
| 5048 InstanceCreationExpression expression = | 5047 InstanceCreationExpression expression = |
| 5049 parseInstanceCreationExpression('A.B/*<E>*/()', token); | 5048 parseInstanceCreationExpression('A.B/*<E>*/()', token); |
| 5050 expect(expression, isNotNull); | 5049 expect(expression, isNotNull); |
| 5051 assertNoErrors(); | 5050 assertNoErrors(); |
| 5052 expect(expression.keyword.keyword, Keyword.NEW); | 5051 expect(expression.keyword.keyword, Keyword.NEW); |
| 5053 ConstructorName name = expression.constructorName; | 5052 ConstructorName name = expression.constructorName; |
| 5054 expect(name, isNotNull); | 5053 expect(name, isNotNull); |
| 5055 TypeName type = name.type; | 5054 TypeName type = name.type; |
| 5056 expect(type, isNotNull); | 5055 expect(type, isNotNull); |
| 5057 expect(type.typeArguments.arguments, hasLength(1)); | 5056 expect(type.typeArguments.arguments, hasLength(1)); |
| 5058 expect(name.period, isNull); | 5057 expect(name.period, isNull); |
| 5059 expect(name.name, isNull); | 5058 expect(name.name, isNull); |
| 5060 expect(expression.argumentList, isNotNull); | 5059 expect(expression.argumentList, isNotNull); |
| 5061 } | 5060 } |
| 5062 | 5061 |
| 5063 void test_parseInstanceCreationExpression_qualifiedType_typeParameters() { | 5062 void test_parseInstanceCreationExpression_qualifiedType_typeArguments() { |
| 5064 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); | 5063 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); |
| 5065 InstanceCreationExpression expression = | 5064 InstanceCreationExpression expression = |
| 5066 parseInstanceCreationExpression('A.B<E>()', token); | 5065 parseInstanceCreationExpression('A.B<E>()', token); |
| 5067 expect(expression, isNotNull); | 5066 expect(expression, isNotNull); |
| 5068 assertNoErrors(); | 5067 assertNoErrors(); |
| 5069 expect(expression.keyword.keyword, Keyword.NEW); | 5068 expect(expression.keyword.keyword, Keyword.NEW); |
| 5070 ConstructorName name = expression.constructorName; | 5069 ConstructorName name = expression.constructorName; |
| 5071 expect(name, isNotNull); | 5070 expect(name, isNotNull); |
| 5072 TypeName type = name.type; | 5071 TypeName type = name.type; |
| 5073 expect(type, isNotNull); | 5072 expect(type, isNotNull); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 5104 ConstructorName name = expression.constructorName; | 5103 ConstructorName name = expression.constructorName; |
| 5105 expect(name, isNotNull); | 5104 expect(name, isNotNull); |
| 5106 TypeName type = name.type; | 5105 TypeName type = name.type; |
| 5107 expect(type, isNotNull); | 5106 expect(type, isNotNull); |
| 5108 expect(type.typeArguments, isNull); | 5107 expect(type.typeArguments, isNull); |
| 5109 expect(name.period, isNull); | 5108 expect(name.period, isNull); |
| 5110 expect(name.name, isNull); | 5109 expect(name.name, isNull); |
| 5111 expect(expression.argumentList, isNotNull); | 5110 expect(expression.argumentList, isNotNull); |
| 5112 } | 5111 } |
| 5113 | 5112 |
| 5114 void test_parseInstanceCreationExpression_type_named_typeParameterComment() { | 5113 void test_parseInstanceCreationExpression_type_named_typeArgumentComments() { |
| 5115 enableGenericMethodComments = true; | 5114 enableGenericMethodComments = true; |
| 5116 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); | 5115 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); |
| 5117 InstanceCreationExpression expression = | 5116 InstanceCreationExpression expression = |
| 5118 parseInstanceCreationExpression('A/*<B>*/.c()', token); | 5117 parseInstanceCreationExpression('A/*<B>*/.c()', token); |
| 5119 expect(expression, isNotNull); | 5118 expect(expression, isNotNull); |
| 5120 assertNoErrors(); | 5119 assertNoErrors(); |
| 5121 expect(expression.keyword.keyword, Keyword.NEW); | 5120 expect(expression.keyword.keyword, Keyword.NEW); |
| 5122 ConstructorName name = expression.constructorName; | 5121 ConstructorName name = expression.constructorName; |
| 5123 expect(name, isNotNull); | 5122 expect(name, isNotNull); |
| 5124 TypeName type = name.type; | 5123 TypeName type = name.type; |
| 5125 expect(type, isNotNull); | 5124 expect(type, isNotNull); |
| 5126 expect(type.typeArguments.arguments, hasLength(1)); | 5125 expect(type.typeArguments.arguments, hasLength(1)); |
| 5127 expect(name.period, isNotNull); | 5126 expect(name.period, isNotNull); |
| 5128 expect(name.name, isNotNull); | 5127 expect(name.name, isNotNull); |
| 5129 expect(expression.argumentList, isNotNull); | 5128 expect(expression.argumentList, isNotNull); |
| 5130 } | 5129 } |
| 5131 | 5130 |
| 5132 void test_parseInstanceCreationExpression_type_named_typeParameters() { | 5131 void test_parseInstanceCreationExpression_type_named_typeArguments() { |
| 5133 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); | 5132 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); |
| 5134 InstanceCreationExpression expression = | 5133 InstanceCreationExpression expression = |
| 5135 parseInstanceCreationExpression('A<B>.c()', token); | 5134 parseInstanceCreationExpression('A<B>.c()', token); |
| 5136 expect(expression, isNotNull); | 5135 expect(expression, isNotNull); |
| 5137 assertNoErrors(); | 5136 assertNoErrors(); |
| 5138 expect(expression.keyword.keyword, Keyword.NEW); | 5137 expect(expression.keyword.keyword, Keyword.NEW); |
| 5139 ConstructorName name = expression.constructorName; | 5138 ConstructorName name = expression.constructorName; |
| 5140 expect(name, isNotNull); | 5139 expect(name, isNotNull); |
| 5141 TypeName type = name.type; | 5140 TypeName type = name.type; |
| 5142 expect(type, isNotNull); | 5141 expect(type, isNotNull); |
| 5143 expect(type.typeArguments.arguments, hasLength(1)); | 5142 expect(type.typeArguments.arguments, hasLength(1)); |
| 5144 expect(name.period, isNotNull); | 5143 expect(name.period, isNotNull); |
| 5145 expect(name.name, isNotNull); | 5144 expect(name.name, isNotNull); |
| 5146 expect(expression.argumentList, isNotNull); | 5145 expect(expression.argumentList, isNotNull); |
| 5147 } | 5146 } |
| 5148 | 5147 |
| 5149 void test_parseInstanceCreationExpression_type_typeParameterComment() { | 5148 void test_parseInstanceCreationExpression_type_typeArgumentComments() { |
| 5150 enableGenericMethodComments = true; | 5149 enableGenericMethodComments = true; |
| 5151 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); | 5150 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); |
| 5152 InstanceCreationExpression expression = | 5151 InstanceCreationExpression expression = |
| 5153 parseInstanceCreationExpression('A/*<B>*/()', token); | 5152 parseInstanceCreationExpression('A/*<B>*/()', token); |
| 5154 expect(expression, isNotNull); | 5153 expect(expression, isNotNull); |
| 5155 assertNoErrors(); | 5154 assertNoErrors(); |
| 5156 expect(expression.keyword.keyword, Keyword.NEW); | 5155 expect(expression.keyword.keyword, Keyword.NEW); |
| 5157 ConstructorName name = expression.constructorName; | 5156 ConstructorName name = expression.constructorName; |
| 5158 expect(name, isNotNull); | 5157 expect(name, isNotNull); |
| 5159 TypeName type = name.type; | 5158 TypeName type = name.type; |
| 5160 expect(type, isNotNull); | 5159 expect(type, isNotNull); |
| 5161 expect(type.typeArguments.arguments, hasLength(1)); | 5160 expect(type.typeArguments.arguments, hasLength(1)); |
| 5162 expect(name.period, isNull); | 5161 expect(name.period, isNull); |
| 5163 expect(name.name, isNull); | 5162 expect(name.name, isNull); |
| 5164 expect(expression.argumentList, isNotNull); | 5163 expect(expression.argumentList, isNotNull); |
| 5165 } | 5164 } |
| 5166 | 5165 |
| 5167 void test_parseInstanceCreationExpression_type_typeParameters() { | 5166 void test_parseInstanceCreationExpression_type_typeArguments() { |
| 5168 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); | 5167 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); |
| 5169 InstanceCreationExpression expression = | 5168 InstanceCreationExpression expression = |
| 5170 parseInstanceCreationExpression('A<B>()', token); | 5169 parseInstanceCreationExpression('A<B>()', token); |
| 5171 expect(expression, isNotNull); | 5170 expect(expression, isNotNull); |
| 5172 assertNoErrors(); | 5171 assertNoErrors(); |
| 5173 expect(expression.keyword.keyword, Keyword.NEW); | 5172 expect(expression.keyword.keyword, Keyword.NEW); |
| 5174 ConstructorName name = expression.constructorName; | 5173 ConstructorName name = expression.constructorName; |
| 5175 expect(name, isNotNull); | 5174 expect(name, isNotNull); |
| 5176 TypeName type = name.type; | 5175 TypeName type = name.type; |
| 5177 expect(type, isNotNull); | 5176 expect(type, isNotNull); |
| 5178 expect(type.typeArguments.arguments, hasLength(1)); | 5177 expect(type.typeArguments.arguments, hasLength(1)); |
| 5179 expect(name.period, isNull); | 5178 expect(name.period, isNull); |
| 5180 expect(name.name, isNull); | 5179 expect(name.name, isNull); |
| 5181 expect(expression.argumentList, isNotNull); | 5180 expect(expression.argumentList, isNotNull); |
| 5182 } | 5181 } |
| 5183 | 5182 |
| 5184 void test_parseInstanceCreationExpression_type_typeParameters_nullable() { | 5183 void test_parseInstanceCreationExpression_type_typeArguments_nullable() { |
| 5185 enableNnbd = true; | 5184 enableNnbd = true; |
| 5186 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); | 5185 Token token = TokenFactory.tokenFromKeyword(Keyword.NEW); |
| 5187 InstanceCreationExpression expression = | 5186 InstanceCreationExpression expression = |
| 5188 parseInstanceCreationExpression('A<B?>()', token); | 5187 parseInstanceCreationExpression('A<B?>()', token); |
| 5189 expect(expression, isNotNull); | 5188 expect(expression, isNotNull); |
| 5190 assertNoErrors(); | 5189 assertNoErrors(); |
| 5191 expect(expression.keyword.keyword, Keyword.NEW); | 5190 expect(expression.keyword.keyword, Keyword.NEW); |
| 5192 ConstructorName name = expression.constructorName; | 5191 ConstructorName name = expression.constructorName; |
| 5193 expect(name, isNotNull); | 5192 expect(name, isNotNull); |
| 5194 TypeName type = name.type; | 5193 TypeName type = name.type; |
| (...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7710 return parser.parseAdditiveExpression(); | 7709 return parser.parseAdditiveExpression(); |
| 7711 } | 7710 } |
| 7712 | 7711 |
| 7713 @override | 7712 @override |
| 7714 Expression parseAssignableExpression(String code, bool primaryAllowed) { | 7713 Expression parseAssignableExpression(String code, bool primaryAllowed) { |
| 7715 createParser(code); | 7714 createParser(code); |
| 7716 return parser.parseAssignableExpression(primaryAllowed); | 7715 return parser.parseAssignableExpression(primaryAllowed); |
| 7717 } | 7716 } |
| 7718 | 7717 |
| 7719 @override | 7718 @override |
| 7720 Expression parseAssignableSelector( | 7719 Expression parseAssignableSelector(String code, bool optional, |
| 7721 String code, bool optional, | |
| 7722 {bool allowConditional: true}) { | 7720 {bool allowConditional: true}) { |
| 7723 Expression prefix = | 7721 Expression prefix = astFactory |
| 7724 astFactory.simpleIdentifier(new StringToken(TokenType.STRING, 'foo', 0))
; | 7722 .simpleIdentifier(new StringToken(TokenType.STRING, 'foo', 0)); |
| 7725 createParser(code); | 7723 createParser(code); |
| 7726 return parser.parseAssignableSelector(prefix, optional, | 7724 return parser.parseAssignableSelector(prefix, optional, |
| 7727 allowConditional: allowConditional); | 7725 allowConditional: allowConditional); |
| 7728 } | 7726 } |
| 7729 | 7727 |
| 7730 @override | 7728 @override |
| 7731 AwaitExpression parseAwaitExpression(String code) { | 7729 AwaitExpression parseAwaitExpression(String code) { |
| 7732 createParser(code); | 7730 createParser(code); |
| 7733 return parser.parseAwaitExpression(); | 7731 return parser.parseAwaitExpression(); |
| 7734 } | 7732 } |
| (...skipping 6841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14576 expect(typeAlias.name, isNotNull); | 14574 expect(typeAlias.name, isNotNull); |
| 14577 expect(typeAlias.typeParameters, isNull); | 14575 expect(typeAlias.typeParameters, isNull); |
| 14578 expect(typeAlias.semicolon, isNotNull); | 14576 expect(typeAlias.semicolon, isNotNull); |
| 14579 GenericFunctionType functionType = typeAlias.functionType; | 14577 GenericFunctionType functionType = typeAlias.functionType; |
| 14580 expect(functionType, isNotNull); | 14578 expect(functionType, isNotNull); |
| 14581 expect(functionType.parameters, isNotNull); | 14579 expect(functionType.parameters, isNotNull); |
| 14582 expect(functionType.returnType, isNotNull); | 14580 expect(functionType.returnType, isNotNull); |
| 14583 expect(functionType.typeParameters, isNull); | 14581 expect(functionType.typeParameters, isNull); |
| 14584 } | 14582 } |
| 14585 } | 14583 } |
| OLD | NEW |