| 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.all_the_rest_test; | 5 library analyzer.test.generated.all_the_rest_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/dart/element/type.dart'; | 9 import 'package:analyzer/dart/element/type.dart'; |
| 10 import 'package:analyzer/file_system/physical_file_system.dart'; | 10 import 'package:analyzer/file_system/physical_file_system.dart'; |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 List<ClassElement> types = holder.types; | 599 List<ClassElement> types = holder.types; |
| 600 expect(types, hasLength(1)); | 600 expect(types, hasLength(1)); |
| 601 ClassElement type = types[0]; | 601 ClassElement type = types[0]; |
| 602 expect(type, isNotNull); | 602 expect(type, isNotNull); |
| 603 expect(type.name, className); | 603 expect(type.name, className); |
| 604 List<TypeParameterElement> typeParameters = type.typeParameters; | 604 List<TypeParameterElement> typeParameters = type.typeParameters; |
| 605 expect(typeParameters, hasLength(0)); | 605 expect(typeParameters, hasLength(0)); |
| 606 expect(type.isAbstract, isFalse); | 606 expect(type.isAbstract, isFalse); |
| 607 expect(type.isMixinApplication, isFalse); | 607 expect(type.isMixinApplication, isFalse); |
| 608 expect(type.isSynthetic, isFalse); | 608 expect(type.isSynthetic, isFalse); |
| 609 expect(type.documentationComment, '/// aaa'); |
| 609 _assertHasDocRange(type, 50, 7); | 610 _assertHasDocRange(type, 50, 7); |
| 610 } | 611 } |
| 611 | 612 |
| 612 void test_visitClassDeclaration_parameterized() { | 613 void test_visitClassDeclaration_parameterized() { |
| 613 ElementHolder holder = new ElementHolder(); | 614 ElementHolder holder = new ElementHolder(); |
| 614 ElementBuilder builder = _makeBuilder(holder); | 615 ElementBuilder builder = _makeBuilder(holder); |
| 615 String className = "C"; | 616 String className = "C"; |
| 616 String firstVariableName = "E"; | 617 String firstVariableName = "E"; |
| 617 String secondVariableName = "F"; | 618 String secondVariableName = "F"; |
| 618 ClassDeclaration classDeclaration = AstFactory.classDeclaration( | 619 ClassDeclaration classDeclaration = AstFactory.classDeclaration( |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 AstFactory.blockFunctionBody2()); | 843 AstFactory.blockFunctionBody2()); |
| 843 constructorDeclaration.documentationComment = AstFactory | 844 constructorDeclaration.documentationComment = AstFactory |
| 844 .documentationComment( | 845 .documentationComment( |
| 845 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); | 846 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); |
| 846 constructorDeclaration.accept(builder); | 847 constructorDeclaration.accept(builder); |
| 847 | 848 |
| 848 List<ConstructorElement> constructors = holder.constructors; | 849 List<ConstructorElement> constructors = holder.constructors; |
| 849 expect(constructors, hasLength(1)); | 850 expect(constructors, hasLength(1)); |
| 850 ConstructorElement constructor = constructors[0]; | 851 ConstructorElement constructor = constructors[0]; |
| 851 expect(constructor, isNotNull); | 852 expect(constructor, isNotNull); |
| 853 expect(constructor.documentationComment, '/// aaa'); |
| 852 _assertHasDocRange(constructor, 50, 7); | 854 _assertHasDocRange(constructor, 50, 7); |
| 853 expect(constructor.isExternal, isFalse); | 855 expect(constructor.isExternal, isFalse); |
| 854 expect(constructor.isFactory, isFalse); | 856 expect(constructor.isFactory, isFalse); |
| 855 expect(constructor.name, ""); | 857 expect(constructor.name, ""); |
| 856 expect(constructor.functions, hasLength(0)); | 858 expect(constructor.functions, hasLength(0)); |
| 857 expect(constructor.labels, hasLength(0)); | 859 expect(constructor.labels, hasLength(0)); |
| 858 expect(constructor.localVariables, hasLength(0)); | 860 expect(constructor.localVariables, hasLength(0)); |
| 859 expect(constructor.parameters, hasLength(0)); | 861 expect(constructor.parameters, hasLength(0)); |
| 860 } | 862 } |
| 861 | 863 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 String enumName = "E"; | 1029 String enumName = "E"; |
| 1028 EnumDeclaration enumDeclaration = | 1030 EnumDeclaration enumDeclaration = |
| 1029 AstFactory.enumDeclaration2(enumName, ["ONE"]); | 1031 AstFactory.enumDeclaration2(enumName, ["ONE"]); |
| 1030 enumDeclaration.documentationComment = AstFactory.documentationComment( | 1032 enumDeclaration.documentationComment = AstFactory.documentationComment( |
| 1031 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); | 1033 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); |
| 1032 enumDeclaration.accept(builder); | 1034 enumDeclaration.accept(builder); |
| 1033 List<ClassElement> enums = holder.enums; | 1035 List<ClassElement> enums = holder.enums; |
| 1034 expect(enums, hasLength(1)); | 1036 expect(enums, hasLength(1)); |
| 1035 ClassElement enumElement = enums[0]; | 1037 ClassElement enumElement = enums[0]; |
| 1036 expect(enumElement, isNotNull); | 1038 expect(enumElement, isNotNull); |
| 1039 expect(enumElement.documentationComment, '/// aaa'); |
| 1037 _assertHasDocRange(enumElement, 50, 7); | 1040 _assertHasDocRange(enumElement, 50, 7); |
| 1038 expect(enumElement.name, enumName); | 1041 expect(enumElement.name, enumName); |
| 1039 } | 1042 } |
| 1040 | 1043 |
| 1041 void test_visitFieldDeclaration() { | 1044 void test_visitFieldDeclaration() { |
| 1042 ElementHolder holder = new ElementHolder(); | 1045 ElementHolder holder = new ElementHolder(); |
| 1043 ElementBuilder builder = _makeBuilder(holder); | 1046 ElementBuilder builder = _makeBuilder(holder); |
| 1044 String firstFieldName = "x"; | 1047 String firstFieldName = "x"; |
| 1045 String secondFieldName = "y"; | 1048 String secondFieldName = "y"; |
| 1046 FieldDeclaration fieldDeclaration = | 1049 FieldDeclaration fieldDeclaration = |
| 1047 AstFactory.fieldDeclaration2(false, null, [ | 1050 AstFactory.fieldDeclaration2(false, null, [ |
| 1048 AstFactory.variableDeclaration(firstFieldName), | 1051 AstFactory.variableDeclaration(firstFieldName), |
| 1049 AstFactory.variableDeclaration(secondFieldName) | 1052 AstFactory.variableDeclaration(secondFieldName) |
| 1050 ]); | 1053 ]); |
| 1051 fieldDeclaration.documentationComment = AstFactory.documentationComment( | 1054 fieldDeclaration.documentationComment = AstFactory.documentationComment( |
| 1052 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); | 1055 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); |
| 1053 fieldDeclaration.accept(builder); | 1056 fieldDeclaration.accept(builder); |
| 1054 | 1057 |
| 1055 List<FieldElement> fields = holder.fields; | 1058 List<FieldElement> fields = holder.fields; |
| 1056 expect(fields, hasLength(2)); | 1059 expect(fields, hasLength(2)); |
| 1057 | 1060 |
| 1058 FieldElement firstField = fields[0]; | 1061 FieldElement firstField = fields[0]; |
| 1059 expect(firstField, isNotNull); | 1062 expect(firstField, isNotNull); |
| 1063 expect(firstField.documentationComment, '/// aaa'); |
| 1060 _assertHasDocRange(firstField, 50, 7); | 1064 _assertHasDocRange(firstField, 50, 7); |
| 1061 expect(firstField.name, firstFieldName); | 1065 expect(firstField.name, firstFieldName); |
| 1062 expect(firstField.initializer, isNull); | 1066 expect(firstField.initializer, isNull); |
| 1063 expect(firstField.isConst, isFalse); | 1067 expect(firstField.isConst, isFalse); |
| 1064 expect(firstField.isFinal, isFalse); | 1068 expect(firstField.isFinal, isFalse); |
| 1065 expect(firstField.isSynthetic, isFalse); | 1069 expect(firstField.isSynthetic, isFalse); |
| 1066 | 1070 |
| 1067 FieldElement secondField = fields[1]; | 1071 FieldElement secondField = fields[1]; |
| 1068 expect(secondField, isNotNull); | 1072 expect(secondField, isNotNull); |
| 1073 expect(secondField.documentationComment, '/// aaa'); |
| 1069 _assertHasDocRange(secondField, 50, 7); | 1074 _assertHasDocRange(secondField, 50, 7); |
| 1070 expect(secondField.name, secondFieldName); | 1075 expect(secondField.name, secondFieldName); |
| 1071 expect(secondField.initializer, isNull); | 1076 expect(secondField.initializer, isNull); |
| 1072 expect(secondField.isConst, isFalse); | 1077 expect(secondField.isConst, isFalse); |
| 1073 expect(secondField.isFinal, isFalse); | 1078 expect(secondField.isFinal, isFalse); |
| 1074 expect(secondField.isSynthetic, isFalse); | 1079 expect(secondField.isSynthetic, isFalse); |
| 1075 } | 1080 } |
| 1076 | 1081 |
| 1077 void test_visitFieldFormalParameter() { | 1082 void test_visitFieldFormalParameter() { |
| 1078 ElementHolder holder = new ElementHolder(); | 1083 ElementHolder holder = new ElementHolder(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 AstFactory.functionExpression2( | 1179 AstFactory.functionExpression2( |
| 1175 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); | 1180 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
| 1176 declaration.documentationComment = AstFactory.documentationComment( | 1181 declaration.documentationComment = AstFactory.documentationComment( |
| 1177 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); | 1182 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); |
| 1178 declaration.accept(builder); | 1183 declaration.accept(builder); |
| 1179 | 1184 |
| 1180 List<PropertyAccessorElement> accessors = holder.accessors; | 1185 List<PropertyAccessorElement> accessors = holder.accessors; |
| 1181 expect(accessors, hasLength(1)); | 1186 expect(accessors, hasLength(1)); |
| 1182 PropertyAccessorElement accessor = accessors[0]; | 1187 PropertyAccessorElement accessor = accessors[0]; |
| 1183 expect(accessor, isNotNull); | 1188 expect(accessor, isNotNull); |
| 1189 expect(accessor.documentationComment, '/// aaa'); |
| 1184 _assertHasDocRange(accessor, 50, 7); | 1190 _assertHasDocRange(accessor, 50, 7); |
| 1185 expect(accessor.name, functionName); | 1191 expect(accessor.name, functionName); |
| 1186 expect(declaration.element, same(accessor)); | 1192 expect(declaration.element, same(accessor)); |
| 1187 expect(declaration.functionExpression.element, same(accessor)); | 1193 expect(declaration.functionExpression.element, same(accessor)); |
| 1188 expect(accessor.hasImplicitReturnType, isTrue); | 1194 expect(accessor.hasImplicitReturnType, isTrue); |
| 1189 expect(accessor.isGetter, isTrue); | 1195 expect(accessor.isGetter, isTrue); |
| 1190 expect(accessor.isExternal, isFalse); | 1196 expect(accessor.isExternal, isFalse); |
| 1191 expect(accessor.isSetter, isFalse); | 1197 expect(accessor.isSetter, isFalse); |
| 1192 expect(accessor.isSynthetic, isFalse); | 1198 expect(accessor.isSynthetic, isFalse); |
| 1193 expect(accessor.typeParameters, hasLength(0)); | 1199 expect(accessor.typeParameters, hasLength(0)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1209 AstFactory.functionExpression2( | 1215 AstFactory.functionExpression2( |
| 1210 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); | 1216 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
| 1211 declaration.documentationComment = AstFactory.documentationComment( | 1217 declaration.documentationComment = AstFactory.documentationComment( |
| 1212 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); | 1218 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); |
| 1213 declaration.accept(builder); | 1219 declaration.accept(builder); |
| 1214 | 1220 |
| 1215 List<FunctionElement> functions = holder.functions; | 1221 List<FunctionElement> functions = holder.functions; |
| 1216 expect(functions, hasLength(1)); | 1222 expect(functions, hasLength(1)); |
| 1217 FunctionElement function = functions[0]; | 1223 FunctionElement function = functions[0]; |
| 1218 expect(function, isNotNull); | 1224 expect(function, isNotNull); |
| 1225 expect(function.documentationComment, '/// aaa'); |
| 1219 _assertHasDocRange(function, 50, 7); | 1226 _assertHasDocRange(function, 50, 7); |
| 1220 expect(function.hasImplicitReturnType, isFalse); | 1227 expect(function.hasImplicitReturnType, isFalse); |
| 1221 expect(function.name, functionName); | 1228 expect(function.name, functionName); |
| 1222 expect(declaration.element, same(function)); | 1229 expect(declaration.element, same(function)); |
| 1223 expect(declaration.functionExpression.element, same(function)); | 1230 expect(declaration.functionExpression.element, same(function)); |
| 1224 expect(function.isExternal, isFalse); | 1231 expect(function.isExternal, isFalse); |
| 1225 expect(function.isSynthetic, isFalse); | 1232 expect(function.isSynthetic, isFalse); |
| 1226 expect(function.typeParameters, hasLength(0)); | 1233 expect(function.typeParameters, hasLength(0)); |
| 1227 } | 1234 } |
| 1228 | 1235 |
| 1229 void test_visitFunctionDeclaration_setter() { | 1236 void test_visitFunctionDeclaration_setter() { |
| 1230 // set f() {} | 1237 // set f() {} |
| 1231 ElementHolder holder = new ElementHolder(); | 1238 ElementHolder holder = new ElementHolder(); |
| 1232 ElementBuilder builder = _makeBuilder(holder); | 1239 ElementBuilder builder = _makeBuilder(holder); |
| 1233 String functionName = "f"; | 1240 String functionName = "f"; |
| 1234 FunctionDeclaration declaration = AstFactory.functionDeclaration( | 1241 FunctionDeclaration declaration = AstFactory.functionDeclaration( |
| 1235 null, | 1242 null, |
| 1236 Keyword.SET, | 1243 Keyword.SET, |
| 1237 functionName, | 1244 functionName, |
| 1238 AstFactory.functionExpression2( | 1245 AstFactory.functionExpression2( |
| 1239 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); | 1246 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
| 1240 declaration.documentationComment = AstFactory.documentationComment( | 1247 declaration.documentationComment = AstFactory.documentationComment( |
| 1241 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); | 1248 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); |
| 1242 declaration.accept(builder); | 1249 declaration.accept(builder); |
| 1243 | 1250 |
| 1244 List<PropertyAccessorElement> accessors = holder.accessors; | 1251 List<PropertyAccessorElement> accessors = holder.accessors; |
| 1245 expect(accessors, hasLength(1)); | 1252 expect(accessors, hasLength(1)); |
| 1246 PropertyAccessorElement accessor = accessors[0]; | 1253 PropertyAccessorElement accessor = accessors[0]; |
| 1247 expect(accessor, isNotNull); | 1254 expect(accessor, isNotNull); |
| 1255 expect(accessor.documentationComment, '/// aaa'); |
| 1248 _assertHasDocRange(accessor, 50, 7); | 1256 _assertHasDocRange(accessor, 50, 7); |
| 1249 expect(accessor.hasImplicitReturnType, isTrue); | 1257 expect(accessor.hasImplicitReturnType, isTrue); |
| 1250 expect(accessor.name, "$functionName="); | 1258 expect(accessor.name, "$functionName="); |
| 1251 expect(declaration.element, same(accessor)); | 1259 expect(declaration.element, same(accessor)); |
| 1252 expect(declaration.functionExpression.element, same(accessor)); | 1260 expect(declaration.functionExpression.element, same(accessor)); |
| 1253 expect(accessor.isGetter, isFalse); | 1261 expect(accessor.isGetter, isFalse); |
| 1254 expect(accessor.isExternal, isFalse); | 1262 expect(accessor.isExternal, isFalse); |
| 1255 expect(accessor.isSetter, isTrue); | 1263 expect(accessor.isSetter, isTrue); |
| 1256 expect(accessor.isSynthetic, isFalse); | 1264 expect(accessor.isSynthetic, isFalse); |
| 1257 expect(accessor.typeParameters, hasLength(0)); | 1265 expect(accessor.typeParameters, hasLength(0)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 FunctionTypeAlias aliasNode = AstFactory.typeAlias( | 1324 FunctionTypeAlias aliasNode = AstFactory.typeAlias( |
| 1317 null, aliasName, AstFactory.typeParameterList([parameterName]), null); | 1325 null, aliasName, AstFactory.typeParameterList([parameterName]), null); |
| 1318 aliasNode.documentationComment = AstFactory.documentationComment( | 1326 aliasNode.documentationComment = AstFactory.documentationComment( |
| 1319 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); | 1327 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); |
| 1320 aliasNode.accept(builder); | 1328 aliasNode.accept(builder); |
| 1321 | 1329 |
| 1322 List<FunctionTypeAliasElement> aliases = holder.typeAliases; | 1330 List<FunctionTypeAliasElement> aliases = holder.typeAliases; |
| 1323 expect(aliases, hasLength(1)); | 1331 expect(aliases, hasLength(1)); |
| 1324 FunctionTypeAliasElement alias = aliases[0]; | 1332 FunctionTypeAliasElement alias = aliases[0]; |
| 1325 expect(alias, isNotNull); | 1333 expect(alias, isNotNull); |
| 1334 expect(alias.documentationComment, '/// aaa'); |
| 1326 _assertHasDocRange(alias, 50, 7); | 1335 _assertHasDocRange(alias, 50, 7); |
| 1327 expect(alias.name, aliasName); | 1336 expect(alias.name, aliasName); |
| 1328 expect(alias.parameters, hasLength(0)); | 1337 expect(alias.parameters, hasLength(0)); |
| 1329 List<TypeParameterElement> typeParameters = alias.typeParameters; | 1338 List<TypeParameterElement> typeParameters = alias.typeParameters; |
| 1330 expect(typeParameters, hasLength(1)); | 1339 expect(typeParameters, hasLength(1)); |
| 1331 TypeParameterElement typeParameter = typeParameters[0]; | 1340 TypeParameterElement typeParameter = typeParameters[0]; |
| 1332 expect(typeParameter, isNotNull); | 1341 expect(typeParameter, isNotNull); |
| 1333 expect(typeParameter.name, parameterName); | 1342 expect(typeParameter.name, parameterName); |
| 1334 } | 1343 } |
| 1335 | 1344 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 | 1490 |
| 1482 List<FieldElement> fields = holder.fields; | 1491 List<FieldElement> fields = holder.fields; |
| 1483 expect(fields, hasLength(1)); | 1492 expect(fields, hasLength(1)); |
| 1484 FieldElement field = fields[0]; | 1493 FieldElement field = fields[0]; |
| 1485 expect(field, isNotNull); | 1494 expect(field, isNotNull); |
| 1486 expect(field.name, methodName); | 1495 expect(field.name, methodName); |
| 1487 expect(field.isSynthetic, isTrue); | 1496 expect(field.isSynthetic, isTrue); |
| 1488 expect(field.setter, isNull); | 1497 expect(field.setter, isNull); |
| 1489 PropertyAccessorElement getter = field.getter; | 1498 PropertyAccessorElement getter = field.getter; |
| 1490 expect(getter, isNotNull); | 1499 expect(getter, isNotNull); |
| 1500 expect(getter.documentationComment, '/// aaa'); |
| 1491 _assertHasDocRange(getter, 50, 7); | 1501 _assertHasDocRange(getter, 50, 7); |
| 1492 expect(getter.hasImplicitReturnType, isTrue); | 1502 expect(getter.hasImplicitReturnType, isTrue); |
| 1493 expect(getter.isAbstract, isFalse); | 1503 expect(getter.isAbstract, isFalse); |
| 1494 expect(getter.isExternal, isFalse); | 1504 expect(getter.isExternal, isFalse); |
| 1495 expect(getter.isGetter, isTrue); | 1505 expect(getter.isGetter, isTrue); |
| 1496 expect(getter.isSynthetic, isFalse); | 1506 expect(getter.isSynthetic, isFalse); |
| 1497 expect(getter.name, methodName); | 1507 expect(getter.name, methodName); |
| 1498 expect(getter.variable, field); | 1508 expect(getter.variable, field); |
| 1499 expect(getter.functions, hasLength(0)); | 1509 expect(getter.functions, hasLength(0)); |
| 1500 expect(getter.labels, hasLength(0)); | 1510 expect(getter.labels, hasLength(0)); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 AstFactory.formalParameterList(), | 1601 AstFactory.formalParameterList(), |
| 1592 AstFactory.blockFunctionBody2()); | 1602 AstFactory.blockFunctionBody2()); |
| 1593 methodDeclaration.documentationComment = AstFactory.documentationComment( | 1603 methodDeclaration.documentationComment = AstFactory.documentationComment( |
| 1594 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); | 1604 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); |
| 1595 methodDeclaration.accept(builder); | 1605 methodDeclaration.accept(builder); |
| 1596 | 1606 |
| 1597 List<MethodElement> methods = holder.methods; | 1607 List<MethodElement> methods = holder.methods; |
| 1598 expect(methods, hasLength(1)); | 1608 expect(methods, hasLength(1)); |
| 1599 MethodElement method = methods[0]; | 1609 MethodElement method = methods[0]; |
| 1600 expect(method, isNotNull); | 1610 expect(method, isNotNull); |
| 1611 expect(method.documentationComment, '/// aaa'); |
| 1601 _assertHasDocRange(method, 50, 7); | 1612 _assertHasDocRange(method, 50, 7); |
| 1602 expect(method.hasImplicitReturnType, isFalse); | 1613 expect(method.hasImplicitReturnType, isFalse); |
| 1603 expect(method.name, methodName); | 1614 expect(method.name, methodName); |
| 1604 expect(method.functions, hasLength(0)); | 1615 expect(method.functions, hasLength(0)); |
| 1605 expect(method.labels, hasLength(0)); | 1616 expect(method.labels, hasLength(0)); |
| 1606 expect(method.localVariables, hasLength(0)); | 1617 expect(method.localVariables, hasLength(0)); |
| 1607 expect(method.parameters, hasLength(0)); | 1618 expect(method.parameters, hasLength(0)); |
| 1608 expect(method.typeParameters, hasLength(0)); | 1619 expect(method.typeParameters, hasLength(0)); |
| 1609 expect(method.isAbstract, isFalse); | 1620 expect(method.isAbstract, isFalse); |
| 1610 expect(method.isExternal, isFalse); | 1621 expect(method.isExternal, isFalse); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 List<FieldElement> fields = holder.fields; | 1676 List<FieldElement> fields = holder.fields; |
| 1666 expect(fields, hasLength(1)); | 1677 expect(fields, hasLength(1)); |
| 1667 FieldElement field = fields[0]; | 1678 FieldElement field = fields[0]; |
| 1668 expect(field, isNotNull); | 1679 expect(field, isNotNull); |
| 1669 expect(field.name, methodName); | 1680 expect(field.name, methodName); |
| 1670 expect(field.isSynthetic, isTrue); | 1681 expect(field.isSynthetic, isTrue); |
| 1671 expect(field.getter, isNull); | 1682 expect(field.getter, isNull); |
| 1672 | 1683 |
| 1673 PropertyAccessorElement setter = field.setter; | 1684 PropertyAccessorElement setter = field.setter; |
| 1674 expect(setter, isNotNull); | 1685 expect(setter, isNotNull); |
| 1686 expect(setter.documentationComment, '/// aaa'); |
| 1675 _assertHasDocRange(setter, 50, 7); | 1687 _assertHasDocRange(setter, 50, 7); |
| 1676 expect(setter.hasImplicitReturnType, isTrue); | 1688 expect(setter.hasImplicitReturnType, isTrue); |
| 1677 expect(setter.isAbstract, isFalse); | 1689 expect(setter.isAbstract, isFalse); |
| 1678 expect(setter.isExternal, isFalse); | 1690 expect(setter.isExternal, isFalse); |
| 1679 expect(setter.isSetter, isTrue); | 1691 expect(setter.isSetter, isTrue); |
| 1680 expect(setter.isSynthetic, isFalse); | 1692 expect(setter.isSynthetic, isFalse); |
| 1681 expect(setter.name, "$methodName="); | 1693 expect(setter.name, "$methodName="); |
| 1682 expect(setter.displayName, methodName); | 1694 expect(setter.displayName, methodName); |
| 1683 expect(setter.variable, field); | 1695 expect(setter.variable, field); |
| 1684 expect(setter.functions, hasLength(0)); | 1696 expect(setter.functions, hasLength(0)); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2228 topLevelVariableDeclaration.documentationComment = AstFactory | 2240 topLevelVariableDeclaration.documentationComment = AstFactory |
| 2229 .documentationComment( | 2241 .documentationComment( |
| 2230 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); | 2242 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); |
| 2231 | 2243 |
| 2232 topLevelVariableDeclaration.accept(builder); | 2244 topLevelVariableDeclaration.accept(builder); |
| 2233 List<TopLevelVariableElement> variables = holder.topLevelVariables; | 2245 List<TopLevelVariableElement> variables = holder.topLevelVariables; |
| 2234 expect(variables, hasLength(2)); | 2246 expect(variables, hasLength(2)); |
| 2235 | 2247 |
| 2236 TopLevelVariableElement variable1 = variables[0]; | 2248 TopLevelVariableElement variable1 = variables[0]; |
| 2237 expect(variable1, isNotNull); | 2249 expect(variable1, isNotNull); |
| 2250 expect(variable1.documentationComment, '/// aaa'); |
| 2238 _assertHasDocRange(variable1, 50, 7); | 2251 _assertHasDocRange(variable1, 50, 7); |
| 2239 | 2252 |
| 2240 TopLevelVariableElement variable2 = variables[1]; | 2253 TopLevelVariableElement variable2 = variables[1]; |
| 2241 expect(variable2, isNotNull); | 2254 expect(variable2, isNotNull); |
| 2255 expect(variable2.documentationComment, '/// aaa'); |
| 2242 _assertHasDocRange(variable2, 50, 7); | 2256 _assertHasDocRange(variable2, 50, 7); |
| 2243 } | 2257 } |
| 2244 | 2258 |
| 2245 void test_visitVariableDeclaration_top_final() { | 2259 void test_visitVariableDeclaration_top_final() { |
| 2246 // final v; | 2260 // final v; |
| 2247 ElementHolder holder = new ElementHolder(); | 2261 ElementHolder holder = new ElementHolder(); |
| 2248 ElementBuilder builder = _makeBuilder(holder); | 2262 ElementBuilder builder = _makeBuilder(holder); |
| 2249 String variableName = "v"; | 2263 String variableName = "v"; |
| 2250 VariableDeclaration variableDeclaration = | 2264 VariableDeclaration variableDeclaration = |
| 2251 AstFactory.variableDeclaration2(variableName, null); | 2265 AstFactory.variableDeclaration2(variableName, null); |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2775 expect(constant.name, thirdName); | 2789 expect(constant.name, thirdName); |
| 2776 expect(constant.isStatic, isTrue); | 2790 expect(constant.isStatic, isTrue); |
| 2777 expect((constant as FieldElementImpl).evaluationResult, isNotNull); | 2791 expect((constant as FieldElementImpl).evaluationResult, isNotNull); |
| 2778 _assertGetter(constant); | 2792 _assertGetter(constant); |
| 2779 } | 2793 } |
| 2780 | 2794 |
| 2781 void test_visitEnumDeclaration_single() { | 2795 void test_visitEnumDeclaration_single() { |
| 2782 String firstName = "ONE"; | 2796 String firstName = "ONE"; |
| 2783 EnumDeclaration enumDeclaration = | 2797 EnumDeclaration enumDeclaration = |
| 2784 AstFactory.enumDeclaration2("E", [firstName]); | 2798 AstFactory.enumDeclaration2("E", [firstName]); |
| 2799 enumDeclaration.constants[0].documentationComment = AstFactory |
| 2800 .documentationComment( |
| 2801 [TokenFactory.tokenFromString('/// aaa')..offset = 50], []); |
| 2785 | 2802 |
| 2786 ClassElement enumElement = _buildElement(enumDeclaration); | 2803 ClassElement enumElement = _buildElement(enumDeclaration); |
| 2787 List<FieldElement> fields = enumElement.fields; | 2804 List<FieldElement> fields = enumElement.fields; |
| 2788 expect(fields, hasLength(3)); | 2805 expect(fields, hasLength(3)); |
| 2789 | 2806 |
| 2790 FieldElement field = fields[0]; | 2807 FieldElement field = fields[0]; |
| 2791 expect(field, isNotNull); | 2808 expect(field, isNotNull); |
| 2792 expect(field.name, "index"); | 2809 expect(field.name, "index"); |
| 2793 expect(field.isStatic, isFalse); | 2810 expect(field.isStatic, isFalse); |
| 2794 expect(field.isSynthetic, isTrue); | 2811 expect(field.isSynthetic, isTrue); |
| 2795 _assertGetter(field); | 2812 _assertGetter(field); |
| 2796 | 2813 |
| 2797 field = fields[1]; | 2814 field = fields[1]; |
| 2798 expect(field, isNotNull); | 2815 expect(field, isNotNull); |
| 2799 expect(field.name, "values"); | 2816 expect(field.name, "values"); |
| 2800 expect(field.isStatic, isTrue); | 2817 expect(field.isStatic, isTrue); |
| 2801 expect(field.isSynthetic, isTrue); | 2818 expect(field.isSynthetic, isTrue); |
| 2802 expect((field as FieldElementImpl).evaluationResult, isNotNull); | 2819 expect((field as FieldElementImpl).evaluationResult, isNotNull); |
| 2803 _assertGetter(field); | 2820 _assertGetter(field); |
| 2804 | 2821 |
| 2805 FieldElement constant = fields[2]; | 2822 FieldElement constant = fields[2]; |
| 2806 expect(constant, isNotNull); | 2823 expect(constant, isNotNull); |
| 2807 expect(constant.name, firstName); | 2824 expect(constant.name, firstName); |
| 2808 expect(constant.isStatic, isTrue); | 2825 expect(constant.isStatic, isTrue); |
| 2809 expect((constant as FieldElementImpl).evaluationResult, isNotNull); | 2826 expect((constant as FieldElementImpl).evaluationResult, isNotNull); |
| 2827 expect(constant.documentationComment, '/// aaa'); |
| 2828 expect(constant.docRange.offset, 50); |
| 2829 expect(constant.docRange.length, 7); |
| 2810 _assertGetter(constant); | 2830 _assertGetter(constant); |
| 2811 } | 2831 } |
| 2812 | 2832 |
| 2813 void _assertGetter(FieldElement field) { | 2833 void _assertGetter(FieldElement field) { |
| 2814 PropertyAccessorElement getter = field.getter; | 2834 PropertyAccessorElement getter = field.getter; |
| 2815 expect(getter, isNotNull); | 2835 expect(getter, isNotNull); |
| 2816 expect(getter.variable, same(field)); | 2836 expect(getter.variable, same(field)); |
| 2817 expect(getter.type, isNotNull); | 2837 expect(getter.type, isNotNull); |
| 2818 } | 2838 } |
| 2819 | 2839 |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4060 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); | 4080 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); |
| 4061 expect(UriKind.fromEncoding(0x58), same(null)); | 4081 expect(UriKind.fromEncoding(0x58), same(null)); |
| 4062 } | 4082 } |
| 4063 | 4083 |
| 4064 void test_getEncoding() { | 4084 void test_getEncoding() { |
| 4065 expect(UriKind.DART_URI.encoding, 0x64); | 4085 expect(UriKind.DART_URI.encoding, 0x64); |
| 4066 expect(UriKind.FILE_URI.encoding, 0x66); | 4086 expect(UriKind.FILE_URI.encoding, 0x66); |
| 4067 expect(UriKind.PACKAGE_URI.encoding, 0x70); | 4087 expect(UriKind.PACKAGE_URI.encoding, 0x70); |
| 4068 } | 4088 } |
| 4069 } | 4089 } |
| OLD | NEW |