| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.element_test; | 8 library engine.element_test; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 expect(types.contains(typeB), isTrue); | 88 expect(types.contains(typeB), isTrue); |
| 89 expect(types.contains(typeObject), isTrue); | 89 expect(types.contains(typeObject), isTrue); |
| 90 expect(types.contains(typeC), isFalse); | 90 expect(types.contains(typeC), isFalse); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void test_getAllSupertypes_recursive() { | 93 void test_getAllSupertypes_recursive() { |
| 94 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 94 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 95 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 95 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 96 classA.supertype = classB.type; | 96 classA.supertype = classB.type; |
| 97 List<InterfaceType> supers = classB.allSupertypes; | 97 List<InterfaceType> supers = classB.allSupertypes; |
| 98 EngineTestCase.assertLength(1, supers); | 98 expect(supers, hasLength(1)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void test_getField() { | 101 void test_getField() { |
| 102 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 102 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 103 String fieldName = "f"; | 103 String fieldName = "f"; |
| 104 FieldElementImpl field = ElementFactory.fieldElement(fieldName, false, false
, false, null); | 104 FieldElementImpl field = ElementFactory.fieldElement(fieldName, false, false
, false, null); |
| 105 classA.fields = <FieldElement> [field]; | 105 classA.fields = <FieldElement> [field]; |
| 106 expect(classA.getField(fieldName), same(field)); | 106 expect(classA.getField(fieldName), same(field)); |
| 107 // no such field | 107 // no such field |
| 108 expect(classA.getField("noSuchField"), same(null)); | 108 expect(classA.getField("noSuchField"), same(null)); |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 void test_equals_notEqual_sameLengths() { | 934 void test_equals_notEqual_sameLengths() { |
| 935 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c"); | 935 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c"); |
| 936 ElementLocationImpl second = new ElementLocationImpl.con2("a;b;d"); | 936 ElementLocationImpl second = new ElementLocationImpl.con2("a;b;d"); |
| 937 expect(first == second, isFalse); | 937 expect(first == second, isFalse); |
| 938 } | 938 } |
| 939 | 939 |
| 940 void test_getComponents() { | 940 void test_getComponents() { |
| 941 String encoding = "a;b;c"; | 941 String encoding = "a;b;c"; |
| 942 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); | 942 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); |
| 943 List<String> components = location.components; | 943 List<String> components = location.components; |
| 944 EngineTestCase.assertLength(3, components); | 944 expect(components, hasLength(3)); |
| 945 expect(components[0], "a"); | 945 expect(components[0], "a"); |
| 946 expect(components[1], "b"); | 946 expect(components[1], "b"); |
| 947 expect(components[2], "c"); | 947 expect(components[2], "c"); |
| 948 } | 948 } |
| 949 | 949 |
| 950 void test_getEncoding() { | 950 void test_getEncoding() { |
| 951 String encoding = "a;b;c;;d"; | 951 String encoding = "a;b;c;;d"; |
| 952 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); | 952 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); |
| 953 expect(location.encoding, encoding); | 953 expect(location.encoding, encoding); |
| 954 } | 954 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 968 | 968 |
| 969 void test_getElement() { | 969 void test_getElement() { |
| 970 FunctionElementImpl typeElement = new FunctionElementImpl.forNode(AstFactory
.identifier3("f")); | 970 FunctionElementImpl typeElement = new FunctionElementImpl.forNode(AstFactory
.identifier3("f")); |
| 971 FunctionTypeImpl type = new FunctionTypeImpl.con1(typeElement); | 971 FunctionTypeImpl type = new FunctionTypeImpl.con1(typeElement); |
| 972 expect(type.element, typeElement); | 972 expect(type.element, typeElement); |
| 973 } | 973 } |
| 974 | 974 |
| 975 void test_getNamedParameterTypes() { | 975 void test_getNamedParameterTypes() { |
| 976 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.fo
rNode(AstFactory.identifier3("f"))); | 976 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.fo
rNode(AstFactory.identifier3("f"))); |
| 977 Map<String, DartType> types = type.namedParameterTypes; | 977 Map<String, DartType> types = type.namedParameterTypes; |
| 978 EngineTestCase.assertSizeOfMap(0, types); | 978 expect(types, hasLength(0)); |
| 979 } | 979 } |
| 980 | 980 |
| 981 void test_getNormalParameterTypes() { | 981 void test_getNormalParameterTypes() { |
| 982 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.fo
rNode(AstFactory.identifier3("f"))); | 982 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.fo
rNode(AstFactory.identifier3("f"))); |
| 983 List<DartType> types = type.normalParameterTypes; | 983 List<DartType> types = type.normalParameterTypes; |
| 984 EngineTestCase.assertLength(0, types); | 984 expect(types, hasLength(0)); |
| 985 } | 985 } |
| 986 | 986 |
| 987 void test_getReturnType() { | 987 void test_getReturnType() { |
| 988 DartType expectedReturnType = VoidTypeImpl.instance; | 988 DartType expectedReturnType = VoidTypeImpl.instance; |
| 989 FunctionElementImpl functionElement = new FunctionElementImpl.forNode(AstFac
tory.identifier3("f")); | 989 FunctionElementImpl functionElement = new FunctionElementImpl.forNode(AstFac
tory.identifier3("f")); |
| 990 functionElement.returnType = expectedReturnType; | 990 functionElement.returnType = expectedReturnType; |
| 991 FunctionTypeImpl type = new FunctionTypeImpl.con1(functionElement); | 991 FunctionTypeImpl type = new FunctionTypeImpl.con1(functionElement); |
| 992 DartType returnType = type.returnType; | 992 DartType returnType = type.returnType; |
| 993 expect(returnType, expectedReturnType); | 993 expect(returnType, expectedReturnType); |
| 994 } | 994 } |
| 995 | 995 |
| 996 void test_getTypeArguments() { | 996 void test_getTypeArguments() { |
| 997 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.fo
rNode(AstFactory.identifier3("f"))); | 997 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.fo
rNode(AstFactory.identifier3("f"))); |
| 998 List<DartType> types = type.typeArguments; | 998 List<DartType> types = type.typeArguments; |
| 999 EngineTestCase.assertLength(0, types); | 999 expect(types, hasLength(0)); |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 void test_hashCode_element() { | 1002 void test_hashCode_element() { |
| 1003 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.fo
rNode(AstFactory.identifier3("f"))); | 1003 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.fo
rNode(AstFactory.identifier3("f"))); |
| 1004 type.hashCode; | 1004 type.hashCode; |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 void test_hashCode_noElement() { | 1007 void test_hashCode_noElement() { |
| 1008 FunctionTypeImpl type = new FunctionTypeImpl.con1(null); | 1008 FunctionTypeImpl type = new FunctionTypeImpl.con1(null); |
| 1009 type.hashCode; | 1009 type.hashCode; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 } | 1335 } |
| 1336 | 1336 |
| 1337 void test_setTypeArguments() { | 1337 void test_setTypeArguments() { |
| 1338 ClassElementImpl enclosingClass = ElementFactory.classElement2("C", ["E"]); | 1338 ClassElementImpl enclosingClass = ElementFactory.classElement2("C", ["E"]); |
| 1339 MethodElementImpl methodElement = new MethodElementImpl.forNode(AstFactory.i
dentifier3("m")); | 1339 MethodElementImpl methodElement = new MethodElementImpl.forNode(AstFactory.i
dentifier3("m")); |
| 1340 enclosingClass.methods = <MethodElement> [methodElement]; | 1340 enclosingClass.methods = <MethodElement> [methodElement]; |
| 1341 FunctionTypeImpl type = new FunctionTypeImpl.con1(methodElement); | 1341 FunctionTypeImpl type = new FunctionTypeImpl.con1(methodElement); |
| 1342 DartType expectedType = enclosingClass.typeParameters[0].type; | 1342 DartType expectedType = enclosingClass.typeParameters[0].type; |
| 1343 type.typeArguments = <DartType> [expectedType]; | 1343 type.typeArguments = <DartType> [expectedType]; |
| 1344 List<DartType> arguments = type.typeArguments; | 1344 List<DartType> arguments = type.typeArguments; |
| 1345 EngineTestCase.assertLength(1, arguments); | 1345 expect(arguments, hasLength(1)); |
| 1346 expect(arguments[0], expectedType); | 1346 expect(arguments[0], expectedType); |
| 1347 } | 1347 } |
| 1348 | 1348 |
| 1349 void test_substitute2_equal() { | 1349 void test_substitute2_equal() { |
| 1350 ClassElementImpl definingClass = ElementFactory.classElement2("C", ["E"]); | 1350 ClassElementImpl definingClass = ElementFactory.classElement2("C", ["E"]); |
| 1351 TypeParameterType parameterType = definingClass.typeParameters[0].type; | 1351 TypeParameterType parameterType = definingClass.typeParameters[0].type; |
| 1352 MethodElementImpl functionElement = new MethodElementImpl.forNode(AstFactory
.identifier3("m")); | 1352 MethodElementImpl functionElement = new MethodElementImpl.forNode(AstFactory
.identifier3("m")); |
| 1353 String namedParameterName = "c"; | 1353 String namedParameterName = "c"; |
| 1354 functionElement.parameters = <ParameterElement> [ | 1354 functionElement.parameters = <ParameterElement> [ |
| 1355 ElementFactory.requiredParameter2("a", parameterType), | 1355 ElementFactory.requiredParameter2("a", parameterType), |
| 1356 ElementFactory.positionalParameter2("b", parameterType), | 1356 ElementFactory.positionalParameter2("b", parameterType), |
| 1357 ElementFactory.namedParameter2(namedParameterName, parameterType)]; | 1357 ElementFactory.namedParameter2(namedParameterName, parameterType)]; |
| 1358 functionElement.returnType = parameterType; | 1358 functionElement.returnType = parameterType; |
| 1359 definingClass.methods = <MethodElement> [functionElement]; | 1359 definingClass.methods = <MethodElement> [functionElement]; |
| 1360 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 1360 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 1361 functionType.typeArguments = <DartType> [parameterType]; | 1361 functionType.typeArguments = <DartType> [parameterType]; |
| 1362 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl.forNode(AstFactory.identifier3("D"))); | 1362 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl.forNode(AstFactory.identifier3("D"))); |
| 1363 FunctionType result = functionType.substitute2(<DartType> [argumentType], <D
artType> [parameterType]); | 1363 FunctionType result = functionType.substitute2(<DartType> [argumentType], <D
artType> [parameterType]); |
| 1364 expect(result.returnType, argumentType); | 1364 expect(result.returnType, argumentType); |
| 1365 List<DartType> normalParameters = result.normalParameterTypes; | 1365 List<DartType> normalParameters = result.normalParameterTypes; |
| 1366 EngineTestCase.assertLength(1, normalParameters); | 1366 expect(normalParameters, hasLength(1)); |
| 1367 expect(normalParameters[0], argumentType); | 1367 expect(normalParameters[0], argumentType); |
| 1368 List<DartType> optionalParameters = result.optionalParameterTypes; | 1368 List<DartType> optionalParameters = result.optionalParameterTypes; |
| 1369 EngineTestCase.assertLength(1, optionalParameters); | 1369 expect(optionalParameters, hasLength(1)); |
| 1370 expect(optionalParameters[0], argumentType); | 1370 expect(optionalParameters[0], argumentType); |
| 1371 Map<String, DartType> namedParameters = result.namedParameterTypes; | 1371 Map<String, DartType> namedParameters = result.namedParameterTypes; |
| 1372 EngineTestCase.assertSizeOfMap(1, namedParameters); | 1372 expect(namedParameters, hasLength(1)); |
| 1373 expect(namedParameters[namedParameterName], argumentType); | 1373 expect(namedParameters[namedParameterName], argumentType); |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 void test_substitute2_notEqual() { | 1376 void test_substitute2_notEqual() { |
| 1377 DartType returnType = new InterfaceTypeImpl.con1(new ClassElementImpl.forNod
e(AstFactory.identifier3("R"))); | 1377 DartType returnType = new InterfaceTypeImpl.con1(new ClassElementImpl.forNod
e(AstFactory.identifier3("R"))); |
| 1378 DartType normalParameterType = new InterfaceTypeImpl.con1(new ClassElementIm
pl.forNode(AstFactory.identifier3("A"))); | 1378 DartType normalParameterType = new InterfaceTypeImpl.con1(new ClassElementIm
pl.forNode(AstFactory.identifier3("A"))); |
| 1379 DartType optionalParameterType = new InterfaceTypeImpl.con1(new ClassElement
Impl.forNode(AstFactory.identifier3("B"))); | 1379 DartType optionalParameterType = new InterfaceTypeImpl.con1(new ClassElement
Impl.forNode(AstFactory.identifier3("B"))); |
| 1380 DartType namedParameterType = new InterfaceTypeImpl.con1(new ClassElementImp
l.forNode(AstFactory.identifier3("C"))); | 1380 DartType namedParameterType = new InterfaceTypeImpl.con1(new ClassElementImp
l.forNode(AstFactory.identifier3("C"))); |
| 1381 FunctionElementImpl functionElement = new FunctionElementImpl.forNode(AstFac
tory.identifier3("f")); | 1381 FunctionElementImpl functionElement = new FunctionElementImpl.forNode(AstFac
tory.identifier3("f")); |
| 1382 String namedParameterName = "c"; | 1382 String namedParameterName = "c"; |
| 1383 functionElement.parameters = <ParameterElement> [ | 1383 functionElement.parameters = <ParameterElement> [ |
| 1384 ElementFactory.requiredParameter2("a", normalParameterType), | 1384 ElementFactory.requiredParameter2("a", normalParameterType), |
| 1385 ElementFactory.positionalParameter2("b", optionalParameterType), | 1385 ElementFactory.positionalParameter2("b", optionalParameterType), |
| 1386 ElementFactory.namedParameter2(namedParameterName, namedParameterType)]; | 1386 ElementFactory.namedParameter2(namedParameterName, namedParameterType)]; |
| 1387 functionElement.returnType = returnType; | 1387 functionElement.returnType = returnType; |
| 1388 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 1388 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 1389 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl.forNode(AstFactory.identifier3("D"))); | 1389 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl.forNode(AstFactory.identifier3("D"))); |
| 1390 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(new TypePara
meterElementImpl.forNode(AstFactory.identifier3("E"))); | 1390 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(new TypePara
meterElementImpl.forNode(AstFactory.identifier3("E"))); |
| 1391 FunctionType result = functionType.substitute2(<DartType> [argumentType], <D
artType> [parameterType]); | 1391 FunctionType result = functionType.substitute2(<DartType> [argumentType], <D
artType> [parameterType]); |
| 1392 expect(result.returnType, returnType); | 1392 expect(result.returnType, returnType); |
| 1393 List<DartType> normalParameters = result.normalParameterTypes; | 1393 List<DartType> normalParameters = result.normalParameterTypes; |
| 1394 EngineTestCase.assertLength(1, normalParameters); | 1394 expect(normalParameters, hasLength(1)); |
| 1395 expect(normalParameters[0], normalParameterType); | 1395 expect(normalParameters[0], normalParameterType); |
| 1396 List<DartType> optionalParameters = result.optionalParameterTypes; | 1396 List<DartType> optionalParameters = result.optionalParameterTypes; |
| 1397 EngineTestCase.assertLength(1, optionalParameters); | 1397 expect(optionalParameters, hasLength(1)); |
| 1398 expect(optionalParameters[0], optionalParameterType); | 1398 expect(optionalParameters[0], optionalParameterType); |
| 1399 Map<String, DartType> namedParameters = result.namedParameterTypes; | 1399 Map<String, DartType> namedParameters = result.namedParameterTypes; |
| 1400 EngineTestCase.assertSizeOfMap(1, namedParameters); | 1400 expect(namedParameters, hasLength(1)); |
| 1401 expect(namedParameters[namedParameterName], namedParameterType); | 1401 expect(namedParameters[namedParameterName], namedParameterType); |
| 1402 } | 1402 } |
| 1403 } | 1403 } |
| 1404 | 1404 |
| 1405 class HtmlElementImplTest extends EngineTestCase { | 1405 class HtmlElementImplTest extends EngineTestCase { |
| 1406 void test_equals_differentSource() { | 1406 void test_equals_differentSource() { |
| 1407 AnalysisContextImpl context = createAnalysisContext(); | 1407 AnalysisContextImpl context = createAnalysisContext(); |
| 1408 HtmlElementImpl elementA = ElementFactory.htmlUnit(context, "indexA.html"); | 1408 HtmlElementImpl elementA = ElementFactory.htmlUnit(context, "indexA.html"); |
| 1409 HtmlElementImpl elementB = ElementFactory.htmlUnit(context, "indexB.html"); | 1409 HtmlElementImpl elementB = ElementFactory.htmlUnit(context, "indexB.html"); |
| 1410 expect(elementA == elementB, isFalse); | 1410 expect(elementA == elementB, isFalse); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 ClassElementImpl classC = ElementFactory.classElement2("C", ["T"]); | 1563 ClassElementImpl classC = ElementFactory.classElement2("C", ["T"]); |
| 1564 ClassElement classD = ElementFactory.classElement2("D", []); | 1564 ClassElement classD = ElementFactory.classElement2("D", []); |
| 1565 InterfaceType typeA = classA.type; | 1565 InterfaceType typeA = classA.type; |
| 1566 classB.interfaces = <InterfaceType> [typeA]; | 1566 classB.interfaces = <InterfaceType> [typeA]; |
| 1567 InterfaceTypeImpl typeBT = new InterfaceTypeImpl.con1(classB); | 1567 InterfaceTypeImpl typeBT = new InterfaceTypeImpl.con1(classB); |
| 1568 DartType typeT = classC.type.typeArguments[0]; | 1568 DartType typeT = classC.type.typeArguments[0]; |
| 1569 typeBT.typeArguments = <DartType> [typeT]; | 1569 typeBT.typeArguments = <DartType> [typeT]; |
| 1570 classC.interfaces = <InterfaceType> [typeBT]; | 1570 classC.interfaces = <InterfaceType> [typeBT]; |
| 1571 // A | 1571 // A |
| 1572 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(typeA); | 1572 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(typeA); |
| 1573 EngineTestCase.assertSizeOfSet(1, superinterfacesOfA); | 1573 expect(superinterfacesOfA, hasLength(1)); |
| 1574 InterfaceType typeObject = ElementFactory.object.type; | 1574 InterfaceType typeObject = ElementFactory.object.type; |
| 1575 expect(superinterfacesOfA.contains(typeObject), isTrue); | 1575 expect(superinterfacesOfA.contains(typeObject), isTrue); |
| 1576 // B<D> | 1576 // B<D> |
| 1577 InterfaceTypeImpl typeBD = new InterfaceTypeImpl.con1(classB); | 1577 InterfaceTypeImpl typeBD = new InterfaceTypeImpl.con1(classB); |
| 1578 typeBD.typeArguments = <DartType> [classD.type]; | 1578 typeBD.typeArguments = <DartType> [classD.type]; |
| 1579 Set<InterfaceType> superinterfacesOfBD = InterfaceTypeImpl.computeSuperinter
faceSet(typeBD); | 1579 Set<InterfaceType> superinterfacesOfBD = InterfaceTypeImpl.computeSuperinter
faceSet(typeBD); |
| 1580 EngineTestCase.assertSizeOfSet(2, superinterfacesOfBD); | 1580 expect(superinterfacesOfBD, hasLength(2)); |
| 1581 expect(superinterfacesOfBD.contains(typeObject), isTrue); | 1581 expect(superinterfacesOfBD.contains(typeObject), isTrue); |
| 1582 expect(superinterfacesOfBD.contains(typeA), isTrue); | 1582 expect(superinterfacesOfBD.contains(typeA), isTrue); |
| 1583 // C<D> | 1583 // C<D> |
| 1584 InterfaceTypeImpl typeCD = new InterfaceTypeImpl.con1(classC); | 1584 InterfaceTypeImpl typeCD = new InterfaceTypeImpl.con1(classC); |
| 1585 typeCD.typeArguments = <DartType> [classD.type]; | 1585 typeCD.typeArguments = <DartType> [classD.type]; |
| 1586 Set<InterfaceType> superinterfacesOfCD = InterfaceTypeImpl.computeSuperinter
faceSet(typeCD); | 1586 Set<InterfaceType> superinterfacesOfCD = InterfaceTypeImpl.computeSuperinter
faceSet(typeCD); |
| 1587 EngineTestCase.assertSizeOfSet(3, superinterfacesOfCD); | 1587 expect(superinterfacesOfCD, hasLength(3)); |
| 1588 expect(superinterfacesOfCD.contains(typeObject), isTrue); | 1588 expect(superinterfacesOfCD.contains(typeObject), isTrue); |
| 1589 expect(superinterfacesOfCD.contains(typeA), isTrue); | 1589 expect(superinterfacesOfCD.contains(typeA), isTrue); |
| 1590 expect(superinterfacesOfCD.contains(typeBD), isTrue); | 1590 expect(superinterfacesOfCD.contains(typeBD), isTrue); |
| 1591 } | 1591 } |
| 1592 | 1592 |
| 1593 void test_computeSuperinterfaceSet_genericSuperclassPath() { | 1593 void test_computeSuperinterfaceSet_genericSuperclassPath() { |
| 1594 // | 1594 // |
| 1595 // A | 1595 // A |
| 1596 // | | 1596 // | |
| 1597 // B<T> | 1597 // B<T> |
| 1598 // | | 1598 // | |
| 1599 // C<T> | 1599 // C<T> |
| 1600 // | 1600 // |
| 1601 // D | 1601 // D |
| 1602 // | 1602 // |
| 1603 ClassElement classA = ElementFactory.classElement2("A", []); | 1603 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1604 InterfaceType typeA = classA.type; | 1604 InterfaceType typeA = classA.type; |
| 1605 ClassElement classB = ElementFactory.classElement("B", typeA, ["T"]); | 1605 ClassElement classB = ElementFactory.classElement("B", typeA, ["T"]); |
| 1606 ClassElementImpl classC = ElementFactory.classElement2("C", ["T"]); | 1606 ClassElementImpl classC = ElementFactory.classElement2("C", ["T"]); |
| 1607 InterfaceTypeImpl typeBT = new InterfaceTypeImpl.con1(classB); | 1607 InterfaceTypeImpl typeBT = new InterfaceTypeImpl.con1(classB); |
| 1608 DartType typeT = classC.type.typeArguments[0]; | 1608 DartType typeT = classC.type.typeArguments[0]; |
| 1609 typeBT.typeArguments = <DartType> [typeT]; | 1609 typeBT.typeArguments = <DartType> [typeT]; |
| 1610 classC.supertype = typeBT; | 1610 classC.supertype = typeBT; |
| 1611 ClassElement classD = ElementFactory.classElement2("D", []); | 1611 ClassElement classD = ElementFactory.classElement2("D", []); |
| 1612 // A | 1612 // A |
| 1613 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(typeA); | 1613 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(typeA); |
| 1614 EngineTestCase.assertSizeOfSet(1, superinterfacesOfA); | 1614 expect(superinterfacesOfA, hasLength(1)); |
| 1615 InterfaceType typeObject = ElementFactory.object.type; | 1615 InterfaceType typeObject = ElementFactory.object.type; |
| 1616 expect(superinterfacesOfA.contains(typeObject), isTrue); | 1616 expect(superinterfacesOfA.contains(typeObject), isTrue); |
| 1617 // B<D> | 1617 // B<D> |
| 1618 InterfaceTypeImpl typeBD = new InterfaceTypeImpl.con1(classB); | 1618 InterfaceTypeImpl typeBD = new InterfaceTypeImpl.con1(classB); |
| 1619 typeBD.typeArguments = <DartType> [classD.type]; | 1619 typeBD.typeArguments = <DartType> [classD.type]; |
| 1620 Set<InterfaceType> superinterfacesOfBD = InterfaceTypeImpl.computeSuperinter
faceSet(typeBD); | 1620 Set<InterfaceType> superinterfacesOfBD = InterfaceTypeImpl.computeSuperinter
faceSet(typeBD); |
| 1621 EngineTestCase.assertSizeOfSet(2, superinterfacesOfBD); | 1621 expect(superinterfacesOfBD, hasLength(2)); |
| 1622 expect(superinterfacesOfBD.contains(typeObject), isTrue); | 1622 expect(superinterfacesOfBD.contains(typeObject), isTrue); |
| 1623 expect(superinterfacesOfBD.contains(typeA), isTrue); | 1623 expect(superinterfacesOfBD.contains(typeA), isTrue); |
| 1624 // C<D> | 1624 // C<D> |
| 1625 InterfaceTypeImpl typeCD = new InterfaceTypeImpl.con1(classC); | 1625 InterfaceTypeImpl typeCD = new InterfaceTypeImpl.con1(classC); |
| 1626 typeCD.typeArguments = <DartType> [classD.type]; | 1626 typeCD.typeArguments = <DartType> [classD.type]; |
| 1627 Set<InterfaceType> superinterfacesOfCD = InterfaceTypeImpl.computeSuperinter
faceSet(typeCD); | 1627 Set<InterfaceType> superinterfacesOfCD = InterfaceTypeImpl.computeSuperinter
faceSet(typeCD); |
| 1628 EngineTestCase.assertSizeOfSet(3, superinterfacesOfCD); | 1628 expect(superinterfacesOfCD, hasLength(3)); |
| 1629 expect(superinterfacesOfCD.contains(typeObject), isTrue); | 1629 expect(superinterfacesOfCD.contains(typeObject), isTrue); |
| 1630 expect(superinterfacesOfCD.contains(typeA), isTrue); | 1630 expect(superinterfacesOfCD.contains(typeA), isTrue); |
| 1631 expect(superinterfacesOfCD.contains(typeBD), isTrue); | 1631 expect(superinterfacesOfCD.contains(typeBD), isTrue); |
| 1632 } | 1632 } |
| 1633 | 1633 |
| 1634 void test_computeSuperinterfaceSet_multipleInterfacePaths() { | 1634 void test_computeSuperinterfaceSet_multipleInterfacePaths() { |
| 1635 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1635 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1636 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 1636 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 1637 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1637 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1638 ClassElementImpl classD = ElementFactory.classElement2("D", []); | 1638 ClassElementImpl classD = ElementFactory.classElement2("D", []); |
| 1639 ClassElementImpl classE = ElementFactory.classElement2("E", []); | 1639 ClassElementImpl classE = ElementFactory.classElement2("E", []); |
| 1640 classB.interfaces = <InterfaceType> [classA.type]; | 1640 classB.interfaces = <InterfaceType> [classA.type]; |
| 1641 classC.interfaces = <InterfaceType> [classA.type]; | 1641 classC.interfaces = <InterfaceType> [classA.type]; |
| 1642 classD.interfaces = <InterfaceType> [classC.type]; | 1642 classD.interfaces = <InterfaceType> [classC.type]; |
| 1643 classE.interfaces = <InterfaceType> [classB.type, classD.type]; | 1643 classE.interfaces = <InterfaceType> [classB.type, classD.type]; |
| 1644 // D | 1644 // D |
| 1645 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); | 1645 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); |
| 1646 EngineTestCase.assertSizeOfSet(3, superinterfacesOfD); | 1646 expect(superinterfacesOfD, hasLength(3)); |
| 1647 expect(superinterfacesOfD.contains(ElementFactory.object.type), isTrue); | 1647 expect(superinterfacesOfD.contains(ElementFactory.object.type), isTrue); |
| 1648 expect(superinterfacesOfD.contains(classA.type), isTrue); | 1648 expect(superinterfacesOfD.contains(classA.type), isTrue); |
| 1649 expect(superinterfacesOfD.contains(classC.type), isTrue); | 1649 expect(superinterfacesOfD.contains(classC.type), isTrue); |
| 1650 // E | 1650 // E |
| 1651 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); | 1651 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); |
| 1652 EngineTestCase.assertSizeOfSet(5, superinterfacesOfE); | 1652 expect(superinterfacesOfE, hasLength(5)); |
| 1653 expect(superinterfacesOfE.contains(ElementFactory.object.type), isTrue); | 1653 expect(superinterfacesOfE.contains(ElementFactory.object.type), isTrue); |
| 1654 expect(superinterfacesOfE.contains(classA.type), isTrue); | 1654 expect(superinterfacesOfE.contains(classA.type), isTrue); |
| 1655 expect(superinterfacesOfE.contains(classB.type), isTrue); | 1655 expect(superinterfacesOfE.contains(classB.type), isTrue); |
| 1656 expect(superinterfacesOfE.contains(classC.type), isTrue); | 1656 expect(superinterfacesOfE.contains(classC.type), isTrue); |
| 1657 expect(superinterfacesOfE.contains(classD.type), isTrue); | 1657 expect(superinterfacesOfE.contains(classD.type), isTrue); |
| 1658 } | 1658 } |
| 1659 | 1659 |
| 1660 void test_computeSuperinterfaceSet_multipleSuperclassPaths() { | 1660 void test_computeSuperinterfaceSet_multipleSuperclassPaths() { |
| 1661 ClassElement classA = ElementFactory.classElement2("A", []); | 1661 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1662 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1662 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1663 ClassElement classC = ElementFactory.classElement("C", classA.type, []); | 1663 ClassElement classC = ElementFactory.classElement("C", classA.type, []); |
| 1664 ClassElement classD = ElementFactory.classElement("D", classC.type, []); | 1664 ClassElement classD = ElementFactory.classElement("D", classC.type, []); |
| 1665 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); | 1665 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); |
| 1666 classE.interfaces = <InterfaceType> [classD.type]; | 1666 classE.interfaces = <InterfaceType> [classD.type]; |
| 1667 // D | 1667 // D |
| 1668 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); | 1668 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); |
| 1669 EngineTestCase.assertSizeOfSet(3, superinterfacesOfD); | 1669 expect(superinterfacesOfD, hasLength(3)); |
| 1670 expect(superinterfacesOfD.contains(ElementFactory.object.type), isTrue); | 1670 expect(superinterfacesOfD.contains(ElementFactory.object.type), isTrue); |
| 1671 expect(superinterfacesOfD.contains(classA.type), isTrue); | 1671 expect(superinterfacesOfD.contains(classA.type), isTrue); |
| 1672 expect(superinterfacesOfD.contains(classC.type), isTrue); | 1672 expect(superinterfacesOfD.contains(classC.type), isTrue); |
| 1673 // E | 1673 // E |
| 1674 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); | 1674 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); |
| 1675 EngineTestCase.assertSizeOfSet(5, superinterfacesOfE); | 1675 expect(superinterfacesOfE, hasLength(5)); |
| 1676 expect(superinterfacesOfE.contains(ElementFactory.object.type), isTrue); | 1676 expect(superinterfacesOfE.contains(ElementFactory.object.type), isTrue); |
| 1677 expect(superinterfacesOfE.contains(classA.type), isTrue); | 1677 expect(superinterfacesOfE.contains(classA.type), isTrue); |
| 1678 expect(superinterfacesOfE.contains(classB.type), isTrue); | 1678 expect(superinterfacesOfE.contains(classB.type), isTrue); |
| 1679 expect(superinterfacesOfE.contains(classC.type), isTrue); | 1679 expect(superinterfacesOfE.contains(classC.type), isTrue); |
| 1680 expect(superinterfacesOfE.contains(classD.type), isTrue); | 1680 expect(superinterfacesOfE.contains(classD.type), isTrue); |
| 1681 } | 1681 } |
| 1682 | 1682 |
| 1683 void test_computeSuperinterfaceSet_recursion() { | 1683 void test_computeSuperinterfaceSet_recursion() { |
| 1684 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1684 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1685 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1685 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1686 classA.supertype = classB.type; | 1686 classA.supertype = classB.type; |
| 1687 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 1687 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
| 1688 EngineTestCase.assertSizeOfSet(2, superinterfacesOfB); | 1688 expect(superinterfacesOfB, hasLength(2)); |
| 1689 } | 1689 } |
| 1690 | 1690 |
| 1691 void test_computeSuperinterfaceSet_singleInterfacePath() { | 1691 void test_computeSuperinterfaceSet_singleInterfacePath() { |
| 1692 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1692 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1693 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 1693 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 1694 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1694 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1695 classB.interfaces = <InterfaceType> [classA.type]; | 1695 classB.interfaces = <InterfaceType> [classA.type]; |
| 1696 classC.interfaces = <InterfaceType> [classB.type]; | 1696 classC.interfaces = <InterfaceType> [classB.type]; |
| 1697 // A | 1697 // A |
| 1698 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); | 1698 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); |
| 1699 EngineTestCase.assertSizeOfSet(1, superinterfacesOfA); | 1699 expect(superinterfacesOfA, hasLength(1)); |
| 1700 expect(superinterfacesOfA.contains(ElementFactory.object.type), isTrue); | 1700 expect(superinterfacesOfA.contains(ElementFactory.object.type), isTrue); |
| 1701 // B | 1701 // B |
| 1702 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 1702 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
| 1703 EngineTestCase.assertSizeOfSet(2, superinterfacesOfB); | 1703 expect(superinterfacesOfB, hasLength(2)); |
| 1704 expect(superinterfacesOfB.contains(ElementFactory.object.type), isTrue); | 1704 expect(superinterfacesOfB.contains(ElementFactory.object.type), isTrue); |
| 1705 expect(superinterfacesOfB.contains(classA.type), isTrue); | 1705 expect(superinterfacesOfB.contains(classA.type), isTrue); |
| 1706 // C | 1706 // C |
| 1707 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); | 1707 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); |
| 1708 EngineTestCase.assertSizeOfSet(3, superinterfacesOfC); | 1708 expect(superinterfacesOfC, hasLength(3)); |
| 1709 expect(superinterfacesOfC.contains(ElementFactory.object.type), isTrue); | 1709 expect(superinterfacesOfC.contains(ElementFactory.object.type), isTrue); |
| 1710 expect(superinterfacesOfC.contains(classA.type), isTrue); | 1710 expect(superinterfacesOfC.contains(classA.type), isTrue); |
| 1711 expect(superinterfacesOfC.contains(classB.type), isTrue); | 1711 expect(superinterfacesOfC.contains(classB.type), isTrue); |
| 1712 } | 1712 } |
| 1713 | 1713 |
| 1714 void test_computeSuperinterfaceSet_singleSuperclassPath() { | 1714 void test_computeSuperinterfaceSet_singleSuperclassPath() { |
| 1715 // | 1715 // |
| 1716 // A | 1716 // A |
| 1717 // | | 1717 // | |
| 1718 // B | 1718 // B |
| 1719 // | | 1719 // | |
| 1720 // C | 1720 // C |
| 1721 // | 1721 // |
| 1722 ClassElement classA = ElementFactory.classElement2("A", []); | 1722 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1723 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1723 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1724 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 1724 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
| 1725 // A | 1725 // A |
| 1726 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); | 1726 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); |
| 1727 EngineTestCase.assertSizeOfSet(1, superinterfacesOfA); | 1727 expect(superinterfacesOfA, hasLength(1)); |
| 1728 expect(superinterfacesOfA.contains(ElementFactory.object.type), isTrue); | 1728 expect(superinterfacesOfA.contains(ElementFactory.object.type), isTrue); |
| 1729 // B | 1729 // B |
| 1730 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 1730 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
| 1731 EngineTestCase.assertSizeOfSet(2, superinterfacesOfB); | 1731 expect(superinterfacesOfB, hasLength(2)); |
| 1732 expect(superinterfacesOfB.contains(ElementFactory.object.type), isTrue); | 1732 expect(superinterfacesOfB.contains(ElementFactory.object.type), isTrue); |
| 1733 expect(superinterfacesOfB.contains(classA.type), isTrue); | 1733 expect(superinterfacesOfB.contains(classA.type), isTrue); |
| 1734 // C | 1734 // C |
| 1735 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); | 1735 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); |
| 1736 EngineTestCase.assertSizeOfSet(3, superinterfacesOfC); | 1736 expect(superinterfacesOfC, hasLength(3)); |
| 1737 expect(superinterfacesOfC.contains(ElementFactory.object.type), isTrue); | 1737 expect(superinterfacesOfC.contains(ElementFactory.object.type), isTrue); |
| 1738 expect(superinterfacesOfC.contains(classA.type), isTrue); | 1738 expect(superinterfacesOfC.contains(classA.type), isTrue); |
| 1739 expect(superinterfacesOfC.contains(classB.type), isTrue); | 1739 expect(superinterfacesOfC.contains(classB.type), isTrue); |
| 1740 } | 1740 } |
| 1741 | 1741 |
| 1742 void test_creation() { | 1742 void test_creation() { |
| 1743 expect(new InterfaceTypeImpl.con1(ElementFactory.classElement2("A", [])), is
NotNull); | 1743 expect(new InterfaceTypeImpl.con1(ElementFactory.classElement2("A", [])), is
NotNull); |
| 1744 } | 1744 } |
| 1745 | 1745 |
| 1746 void test_getAccessors() { | 1746 void test_getAccessors() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 // | 1811 // |
| 1812 // class C implements A, B | 1812 // class C implements A, B |
| 1813 // | 1813 // |
| 1814 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1814 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1815 InterfaceType typeA = classA.type; | 1815 InterfaceType typeA = classA.type; |
| 1816 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 1816 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 1817 InterfaceType typeB = classB.type; | 1817 InterfaceType typeB = classB.type; |
| 1818 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1818 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1819 classC.interfaces = <InterfaceType> [typeA, typeB]; | 1819 classC.interfaces = <InterfaceType> [typeA, typeB]; |
| 1820 List<InterfaceType> interfaces = classC.type.interfaces; | 1820 List<InterfaceType> interfaces = classC.type.interfaces; |
| 1821 EngineTestCase.assertLength(2, interfaces); | 1821 expect(interfaces, hasLength(2)); |
| 1822 if (identical(interfaces[0], typeA)) { | 1822 if (identical(interfaces[0], typeA)) { |
| 1823 expect(interfaces[1], same(typeB)); | 1823 expect(interfaces[1], same(typeB)); |
| 1824 } else { | 1824 } else { |
| 1825 expect(interfaces[0], same(typeB)); | 1825 expect(interfaces[0], same(typeB)); |
| 1826 expect(interfaces[1], same(typeA)); | 1826 expect(interfaces[1], same(typeA)); |
| 1827 } | 1827 } |
| 1828 } | 1828 } |
| 1829 | 1829 |
| 1830 void test_getInterfaces_parameterized() { | 1830 void test_getInterfaces_parameterized() { |
| 1831 // | 1831 // |
| 1832 // class A<E> | 1832 // class A<E> |
| 1833 // class B<F> implements A<F> | 1833 // class B<F> implements A<F> |
| 1834 // | 1834 // |
| 1835 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 1835 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 1836 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 1836 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 1837 InterfaceType typeB = classB.type; | 1837 InterfaceType typeB = classB.type; |
| 1838 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 1838 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 1839 typeAF.typeArguments = <DartType> [typeB.typeArguments[0]]; | 1839 typeAF.typeArguments = <DartType> [typeB.typeArguments[0]]; |
| 1840 classB.interfaces = <InterfaceType> [typeAF]; | 1840 classB.interfaces = <InterfaceType> [typeAF]; |
| 1841 // | 1841 // |
| 1842 // B<I> | 1842 // B<I> |
| 1843 // | 1843 // |
| 1844 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 1844 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 1845 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 1845 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 1846 typeBI.typeArguments = <DartType> [typeI]; | 1846 typeBI.typeArguments = <DartType> [typeI]; |
| 1847 List<InterfaceType> interfaces = typeBI.interfaces; | 1847 List<InterfaceType> interfaces = typeBI.interfaces; |
| 1848 EngineTestCase.assertLength(1, interfaces); | 1848 expect(interfaces, hasLength(1)); |
| 1849 InterfaceType result = interfaces[0]; | 1849 InterfaceType result = interfaces[0]; |
| 1850 expect(result.element, same(classA)); | 1850 expect(result.element, same(classA)); |
| 1851 expect(result.typeArguments[0], same(typeI)); | 1851 expect(result.typeArguments[0], same(typeI)); |
| 1852 } | 1852 } |
| 1853 | 1853 |
| 1854 void test_getLeastUpperBound_directInterfaceCase() { | 1854 void test_getLeastUpperBound_directInterfaceCase() { |
| 1855 // | 1855 // |
| 1856 // class A | 1856 // class A |
| 1857 // class B implements A | 1857 // class B implements A |
| 1858 // class C implements B | 1858 // class C implements B |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2108 // A<I> | 2108 // A<I> |
| 2109 // | 2109 // |
| 2110 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 2110 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 2111 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 2111 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 2112 typeAI.typeArguments = <DartType> [typeI]; | 2112 typeAI.typeArguments = <DartType> [typeI]; |
| 2113 MethodElement method = typeAI.getMethod(methodName); | 2113 MethodElement method = typeAI.getMethod(methodName); |
| 2114 expect(method, isNotNull); | 2114 expect(method, isNotNull); |
| 2115 FunctionType methodType = method.type; | 2115 FunctionType methodType = method.type; |
| 2116 expect(methodType.returnType, same(typeI)); | 2116 expect(methodType.returnType, same(typeI)); |
| 2117 List<DartType> parameterTypes = methodType.normalParameterTypes; | 2117 List<DartType> parameterTypes = methodType.normalParameterTypes; |
| 2118 EngineTestCase.assertLength(1, parameterTypes); | 2118 expect(parameterTypes, hasLength(1)); |
| 2119 expect(parameterTypes[0], same(typeI)); | 2119 expect(parameterTypes[0], same(typeI)); |
| 2120 } | 2120 } |
| 2121 | 2121 |
| 2122 void test_getMethod_unimplemented() { | 2122 void test_getMethod_unimplemented() { |
| 2123 // | 2123 // |
| 2124 // class A {} | 2124 // class A {} |
| 2125 // | 2125 // |
| 2126 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2126 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2127 InterfaceType typeA = classA.type; | 2127 InterfaceType typeA = classA.type; |
| 2128 expect(typeA.getMethod("m"), isNull); | 2128 expect(typeA.getMethod("m"), isNull); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2147 // | 2147 // |
| 2148 // class C extends Object with A, B | 2148 // class C extends Object with A, B |
| 2149 // | 2149 // |
| 2150 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2150 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2151 InterfaceType typeA = classA.type; | 2151 InterfaceType typeA = classA.type; |
| 2152 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 2152 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 2153 InterfaceType typeB = classB.type; | 2153 InterfaceType typeB = classB.type; |
| 2154 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 2154 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 2155 classC.mixins = <InterfaceType> [typeA, typeB]; | 2155 classC.mixins = <InterfaceType> [typeA, typeB]; |
| 2156 List<InterfaceType> interfaces = classC.type.mixins; | 2156 List<InterfaceType> interfaces = classC.type.mixins; |
| 2157 EngineTestCase.assertLength(2, interfaces); | 2157 expect(interfaces, hasLength(2)); |
| 2158 if (identical(interfaces[0], typeA)) { | 2158 if (identical(interfaces[0], typeA)) { |
| 2159 expect(interfaces[1], same(typeB)); | 2159 expect(interfaces[1], same(typeB)); |
| 2160 } else { | 2160 } else { |
| 2161 expect(interfaces[0], same(typeB)); | 2161 expect(interfaces[0], same(typeB)); |
| 2162 expect(interfaces[1], same(typeA)); | 2162 expect(interfaces[1], same(typeA)); |
| 2163 } | 2163 } |
| 2164 } | 2164 } |
| 2165 | 2165 |
| 2166 void test_getMixins_parameterized() { | 2166 void test_getMixins_parameterized() { |
| 2167 // | 2167 // |
| 2168 // class A<E> | 2168 // class A<E> |
| 2169 // class B<F> extends Object with A<F> | 2169 // class B<F> extends Object with A<F> |
| 2170 // | 2170 // |
| 2171 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 2171 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 2172 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 2172 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 2173 InterfaceType typeB = classB.type; | 2173 InterfaceType typeB = classB.type; |
| 2174 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 2174 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 2175 typeAF.typeArguments = <DartType> [typeB.typeArguments[0]]; | 2175 typeAF.typeArguments = <DartType> [typeB.typeArguments[0]]; |
| 2176 classB.mixins = <InterfaceType> [typeAF]; | 2176 classB.mixins = <InterfaceType> [typeAF]; |
| 2177 // | 2177 // |
| 2178 // B<I> | 2178 // B<I> |
| 2179 // | 2179 // |
| 2180 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 2180 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 2181 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 2181 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 2182 typeBI.typeArguments = <DartType> [typeI]; | 2182 typeBI.typeArguments = <DartType> [typeI]; |
| 2183 List<InterfaceType> interfaces = typeBI.mixins; | 2183 List<InterfaceType> interfaces = typeBI.mixins; |
| 2184 EngineTestCase.assertLength(1, interfaces); | 2184 expect(interfaces, hasLength(1)); |
| 2185 InterfaceType result = interfaces[0]; | 2185 InterfaceType result = interfaces[0]; |
| 2186 expect(result.element, same(classA)); | 2186 expect(result.element, same(classA)); |
| 2187 expect(result.typeArguments[0], same(typeI)); | 2187 expect(result.typeArguments[0], same(typeI)); |
| 2188 } | 2188 } |
| 2189 | 2189 |
| 2190 void test_getSetter_implemented() { | 2190 void test_getSetter_implemented() { |
| 2191 // | 2191 // |
| 2192 // class A { s() {} } | 2192 // class A { s() {} } |
| 2193 // | 2193 // |
| 2194 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2194 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2212 // | 2212 // |
| 2213 // A<I> | 2213 // A<I> |
| 2214 // | 2214 // |
| 2215 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 2215 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 2216 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 2216 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 2217 typeAI.typeArguments = <DartType> [typeI]; | 2217 typeAI.typeArguments = <DartType> [typeI]; |
| 2218 PropertyAccessorElement setter = typeAI.getSetter(setterName); | 2218 PropertyAccessorElement setter = typeAI.getSetter(setterName); |
| 2219 expect(setter, isNotNull); | 2219 expect(setter, isNotNull); |
| 2220 FunctionType setterType = setter.type; | 2220 FunctionType setterType = setter.type; |
| 2221 List<DartType> parameterTypes = setterType.normalParameterTypes; | 2221 List<DartType> parameterTypes = setterType.normalParameterTypes; |
| 2222 EngineTestCase.assertLength(1, parameterTypes); | 2222 expect(parameterTypes, hasLength(1)); |
| 2223 expect(parameterTypes[0], same(typeI)); | 2223 expect(parameterTypes[0], same(typeI)); |
| 2224 } | 2224 } |
| 2225 | 2225 |
| 2226 void test_getSetter_unimplemented() { | 2226 void test_getSetter_unimplemented() { |
| 2227 // | 2227 // |
| 2228 // class A {} | 2228 // class A {} |
| 2229 // | 2229 // |
| 2230 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2230 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2231 InterfaceType typeA = classA.type; | 2231 InterfaceType typeA = classA.type; |
| 2232 expect(typeA.getSetter("s"), isNull); | 2232 expect(typeA.getSetter("s"), isNull); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2260 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 2260 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 2261 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 2261 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 2262 typeBI.typeArguments = <DartType> [typeI]; | 2262 typeBI.typeArguments = <DartType> [typeI]; |
| 2263 InterfaceType superclass = typeBI.superclass; | 2263 InterfaceType superclass = typeBI.superclass; |
| 2264 expect(superclass.element, same(classA)); | 2264 expect(superclass.element, same(classA)); |
| 2265 expect(superclass.typeArguments[0], same(typeI)); | 2265 expect(superclass.typeArguments[0], same(typeI)); |
| 2266 } | 2266 } |
| 2267 | 2267 |
| 2268 void test_getTypeArguments_empty() { | 2268 void test_getTypeArguments_empty() { |
| 2269 InterfaceType type = ElementFactory.classElement2("A", []).type; | 2269 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 2270 EngineTestCase.assertLength(0, type.typeArguments); | 2270 expect(type.typeArguments, hasLength(0)); |
| 2271 } | 2271 } |
| 2272 | 2272 |
| 2273 void test_hashCode() { | 2273 void test_hashCode() { |
| 2274 ClassElement classA = ElementFactory.classElement2("A", []); | 2274 ClassElement classA = ElementFactory.classElement2("A", []); |
| 2275 InterfaceType typeA = classA.type; | 2275 InterfaceType typeA = classA.type; |
| 2276 expect(0 == typeA.hashCode, isFalse); | 2276 expect(0 == typeA.hashCode, isFalse); |
| 2277 } | 2277 } |
| 2278 | 2278 |
| 2279 void test_isAssignableTo_typeVariables() { | 2279 void test_isAssignableTo_typeVariables() { |
| 2280 // | 2280 // |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2813 // B<I> | 2813 // B<I> |
| 2814 // | 2814 // |
| 2815 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 2815 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 2816 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 2816 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 2817 typeBI.typeArguments = <DartType> [typeI]; | 2817 typeBI.typeArguments = <DartType> [typeI]; |
| 2818 MethodElement method = typeBI.lookUpMethod(methodName, library); | 2818 MethodElement method = typeBI.lookUpMethod(methodName, library); |
| 2819 expect(method, isNotNull); | 2819 expect(method, isNotNull); |
| 2820 FunctionType methodType = method.type; | 2820 FunctionType methodType = method.type; |
| 2821 expect(methodType.returnType, same(typeI)); | 2821 expect(methodType.returnType, same(typeI)); |
| 2822 List<DartType> parameterTypes = methodType.normalParameterTypes; | 2822 List<DartType> parameterTypes = methodType.normalParameterTypes; |
| 2823 EngineTestCase.assertLength(1, parameterTypes); | 2823 expect(parameterTypes, hasLength(1)); |
| 2824 expect(parameterTypes[0], same(typeI)); | 2824 expect(parameterTypes[0], same(typeI)); |
| 2825 } | 2825 } |
| 2826 | 2826 |
| 2827 void test_lookUpMethod_recursive() { | 2827 void test_lookUpMethod_recursive() { |
| 2828 // | 2828 // |
| 2829 // class A extends B {} | 2829 // class A extends B {} |
| 2830 // class B extends A {} | 2830 // class B extends A {} |
| 2831 // | 2831 // |
| 2832 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2832 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2833 InterfaceType typeA = classA.type; | 2833 InterfaceType typeA = classA.type; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2921 | 2921 |
| 2922 void test_substitute_equal() { | 2922 void test_substitute_equal() { |
| 2923 ClassElement classAE = ElementFactory.classElement2("A", ["E"]); | 2923 ClassElement classAE = ElementFactory.classElement2("A", ["E"]); |
| 2924 InterfaceType typeAE = classAE.type; | 2924 InterfaceType typeAE = classAE.type; |
| 2925 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; | 2925 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; |
| 2926 List<DartType> args = [argumentType]; | 2926 List<DartType> args = [argumentType]; |
| 2927 List<DartType> params = [classAE.typeParameters[0].type]; | 2927 List<DartType> params = [classAE.typeParameters[0].type]; |
| 2928 InterfaceType typeAESubbed = typeAE.substitute2(args, params); | 2928 InterfaceType typeAESubbed = typeAE.substitute2(args, params); |
| 2929 expect(typeAESubbed.element, classAE); | 2929 expect(typeAESubbed.element, classAE); |
| 2930 List<DartType> resultArguments = typeAESubbed.typeArguments; | 2930 List<DartType> resultArguments = typeAESubbed.typeArguments; |
| 2931 EngineTestCase.assertLength(1, resultArguments); | 2931 expect(resultArguments, hasLength(1)); |
| 2932 expect(resultArguments[0], argumentType); | 2932 expect(resultArguments[0], argumentType); |
| 2933 } | 2933 } |
| 2934 | 2934 |
| 2935 void test_substitute_exception() { | 2935 void test_substitute_exception() { |
| 2936 try { | 2936 try { |
| 2937 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2937 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2938 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); | 2938 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); |
| 2939 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; | 2939 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; |
| 2940 type.substitute2(<DartType> [argumentType], <DartType> []); | 2940 type.substitute2(<DartType> [argumentType], <DartType> []); |
| 2941 fail("Expected to encounter exception, argument and parameter type array l
engths not equal."); | 2941 fail("Expected to encounter exception, argument and parameter type array l
engths not equal."); |
| 2942 } catch (e) { | 2942 } catch (e) { |
| 2943 // Expected result | 2943 // Expected result |
| 2944 } | 2944 } |
| 2945 } | 2945 } |
| 2946 | 2946 |
| 2947 void test_substitute_notEqual() { | 2947 void test_substitute_notEqual() { |
| 2948 // The [test_substitute_equals] above has a slightly higher level implementa
tion. | 2948 // The [test_substitute_equals] above has a slightly higher level implementa
tion. |
| 2949 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2949 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2950 TypeParameterElementImpl parameterElement = new TypeParameterElementImpl.for
Node(AstFactory.identifier3("E")); | 2950 TypeParameterElementImpl parameterElement = new TypeParameterElementImpl.for
Node(AstFactory.identifier3("E")); |
| 2951 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); | 2951 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); |
| 2952 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(parameterElement
); | 2952 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(parameterElement
); |
| 2953 type.typeArguments = <DartType> [parameter]; | 2953 type.typeArguments = <DartType> [parameter]; |
| 2954 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; | 2954 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; |
| 2955 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(new TypePara
meterElementImpl.forNode(AstFactory.identifier3("F"))); | 2955 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(new TypePara
meterElementImpl.forNode(AstFactory.identifier3("F"))); |
| 2956 InterfaceType result = type.substitute2(<DartType> [argumentType], <DartType
> [parameterType]); | 2956 InterfaceType result = type.substitute2(<DartType> [argumentType], <DartType
> [parameterType]); |
| 2957 expect(result.element, classA); | 2957 expect(result.element, classA); |
| 2958 List<DartType> resultArguments = result.typeArguments; | 2958 List<DartType> resultArguments = result.typeArguments; |
| 2959 EngineTestCase.assertLength(1, resultArguments); | 2959 expect(resultArguments, hasLength(1)); |
| 2960 expect(resultArguments[0], parameter); | 2960 expect(resultArguments[0], parameter); |
| 2961 } | 2961 } |
| 2962 } | 2962 } |
| 2963 | 2963 |
| 2964 class InterfaceTypeImpl_FunctionTypeImplTest_test_isSubtypeOf_baseCase_classFunc
tion extends InterfaceTypeImpl { | 2964 class InterfaceTypeImpl_FunctionTypeImplTest_test_isSubtypeOf_baseCase_classFunc
tion extends InterfaceTypeImpl { |
| 2965 InterfaceTypeImpl_FunctionTypeImplTest_test_isSubtypeOf_baseCase_classFunction
(ClassElement arg0) : super.con1(arg0); | 2965 InterfaceTypeImpl_FunctionTypeImplTest_test_isSubtypeOf_baseCase_classFunction
(ClassElement arg0) : super.con1(arg0); |
| 2966 | 2966 |
| 2967 @override | 2967 @override |
| 2968 bool get isDartCoreFunction => true; | 2968 bool get isDartCoreFunction => true; |
| 2969 } | 2969 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2999 PrefixElement prefixA = new PrefixElementImpl.forNode(AstFactory.identifier3
("a")); | 2999 PrefixElement prefixA = new PrefixElementImpl.forNode(AstFactory.identifier3
("a")); |
| 3000 PrefixElement prefixB = new PrefixElementImpl.forNode(AstFactory.identifier3
("b")); | 3000 PrefixElement prefixB = new PrefixElementImpl.forNode(AstFactory.identifier3
("b")); |
| 3001 List<ImportElementImpl> imports = [ | 3001 List<ImportElementImpl> imports = [ |
| 3002 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), | 3002 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), |
| 3003 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
), | 3003 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
), |
| 3004 ElementFactory.importFor(ElementFactory.library(context, "l4"), prefixA,
[]), | 3004 ElementFactory.importFor(ElementFactory.library(context, "l4"), prefixA,
[]), |
| 3005 ElementFactory.importFor(ElementFactory.library(context, "l5"), prefixA,
[]), | 3005 ElementFactory.importFor(ElementFactory.library(context, "l5"), prefixA,
[]), |
| 3006 ElementFactory.importFor(ElementFactory.library(context, "l6"), prefixB,
[])]; | 3006 ElementFactory.importFor(ElementFactory.library(context, "l6"), prefixB,
[])]; |
| 3007 library.imports = imports; | 3007 library.imports = imports; |
| 3008 List<PrefixElement> prefixes = library.prefixes; | 3008 List<PrefixElement> prefixes = library.prefixes; |
| 3009 EngineTestCase.assertLength(2, prefixes); | 3009 expect(prefixes, hasLength(2)); |
| 3010 if (identical(prefixA, prefixes[0])) { | 3010 if (identical(prefixA, prefixes[0])) { |
| 3011 expect(prefixes[1], same(prefixB)); | 3011 expect(prefixes[1], same(prefixB)); |
| 3012 } else { | 3012 } else { |
| 3013 expect(prefixes[0], same(prefixB)); | 3013 expect(prefixes[0], same(prefixB)); |
| 3014 expect(prefixes[1], same(prefixA)); | 3014 expect(prefixes[1], same(prefixA)); |
| 3015 } | 3015 } |
| 3016 } | 3016 } |
| 3017 | 3017 |
| 3018 void test_getUnits() { | 3018 void test_getUnits() { |
| 3019 AnalysisContext context = createAnalysisContext(); | 3019 AnalysisContext context = createAnalysisContext(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3096 } | 3096 } |
| 3097 | 3097 |
| 3098 void test_setImports() { | 3098 void test_setImports() { |
| 3099 AnalysisContext context = createAnalysisContext(); | 3099 AnalysisContext context = createAnalysisContext(); |
| 3100 LibraryElementImpl library = new LibraryElementImpl.forNode(context, AstFact
ory.libraryIdentifier2(["l1"])); | 3100 LibraryElementImpl library = new LibraryElementImpl.forNode(context, AstFact
ory.libraryIdentifier2(["l1"])); |
| 3101 List<ImportElementImpl> expectedImports = [ | 3101 List<ImportElementImpl> expectedImports = [ |
| 3102 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), | 3102 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), |
| 3103 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
)]; | 3103 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
)]; |
| 3104 library.imports = expectedImports; | 3104 library.imports = expectedImports; |
| 3105 List<ImportElement> actualImports = library.imports; | 3105 List<ImportElement> actualImports = library.imports; |
| 3106 EngineTestCase.assertLength(expectedImports.length, actualImports); | 3106 expect(actualImports, hasLength(expectedImports.length)); |
| 3107 for (int i = 0; i < actualImports.length; i++) { | 3107 for (int i = 0; i < actualImports.length; i++) { |
| 3108 expect(actualImports[i], same(expectedImports[i])); | 3108 expect(actualImports[i], same(expectedImports[i])); |
| 3109 } | 3109 } |
| 3110 } | 3110 } |
| 3111 } | 3111 } |
| 3112 | 3112 |
| 3113 class MultiplyDefinedElementImplTest extends EngineTestCase { | 3113 class MultiplyDefinedElementImplTest extends EngineTestCase { |
| 3114 void test_fromElements_conflicting() { | 3114 void test_fromElements_conflicting() { |
| 3115 Element firstElement = ElementFactory.localVariableElement2("xx"); | 3115 Element firstElement = ElementFactory.localVariableElement2("xx"); |
| 3116 Element secondElement = ElementFactory.localVariableElement2("yy"); | 3116 Element secondElement = ElementFactory.localVariableElement2("yy"); |
| 3117 Element result = MultiplyDefinedElementImpl.fromElements(null, firstElement,
secondElement); | 3117 Element result = MultiplyDefinedElementImpl.fromElements(null, firstElement,
secondElement); |
| 3118 EngineTestCase.assertInstanceOf((obj) => obj is MultiplyDefinedElement, Mult
iplyDefinedElement, result); | 3118 EngineTestCase.assertInstanceOf((obj) => obj is MultiplyDefinedElement, Mult
iplyDefinedElement, result); |
| 3119 List<Element> elements = (result as MultiplyDefinedElement).conflictingEleme
nts; | 3119 List<Element> elements = (result as MultiplyDefinedElement).conflictingEleme
nts; |
| 3120 EngineTestCase.assertLength(2, elements); | 3120 expect(elements, hasLength(2)); |
| 3121 for (int i = 0; i < elements.length; i++) { | 3121 for (int i = 0; i < elements.length; i++) { |
| 3122 EngineTestCase.assertInstanceOf((obj) => obj is LocalVariableElement, Loca
lVariableElement, elements[i]); | 3122 EngineTestCase.assertInstanceOf((obj) => obj is LocalVariableElement, Loca
lVariableElement, elements[i]); |
| 3123 } | 3123 } |
| 3124 } | 3124 } |
| 3125 | 3125 |
| 3126 void test_fromElements_multiple() { | 3126 void test_fromElements_multiple() { |
| 3127 Element firstElement = ElementFactory.localVariableElement2("xx"); | 3127 Element firstElement = ElementFactory.localVariableElement2("xx"); |
| 3128 Element secondElement = ElementFactory.localVariableElement2("yy"); | 3128 Element secondElement = ElementFactory.localVariableElement2("yy"); |
| 3129 Element thirdElement = ElementFactory.localVariableElement2("zz"); | 3129 Element thirdElement = ElementFactory.localVariableElement2("zz"); |
| 3130 Element result = MultiplyDefinedElementImpl.fromElements(null, MultiplyDefin
edElementImpl.fromElements(null, firstElement, secondElement), thirdElement); | 3130 Element result = MultiplyDefinedElementImpl.fromElements(null, MultiplyDefin
edElementImpl.fromElements(null, firstElement, secondElement), thirdElement); |
| 3131 EngineTestCase.assertInstanceOf((obj) => obj is MultiplyDefinedElement, Mult
iplyDefinedElement, result); | 3131 EngineTestCase.assertInstanceOf((obj) => obj is MultiplyDefinedElement, Mult
iplyDefinedElement, result); |
| 3132 List<Element> elements = (result as MultiplyDefinedElement).conflictingEleme
nts; | 3132 List<Element> elements = (result as MultiplyDefinedElement).conflictingEleme
nts; |
| 3133 EngineTestCase.assertLength(3, elements); | 3133 expect(elements, hasLength(3)); |
| 3134 for (int i = 0; i < elements.length; i++) { | 3134 for (int i = 0; i < elements.length; i++) { |
| 3135 EngineTestCase.assertInstanceOf((obj) => obj is LocalVariableElement, Loca
lVariableElement, elements[i]); | 3135 EngineTestCase.assertInstanceOf((obj) => obj is LocalVariableElement, Loca
lVariableElement, elements[i]); |
| 3136 } | 3136 } |
| 3137 } | 3137 } |
| 3138 | 3138 |
| 3139 void test_fromElements_nonConflicting() { | 3139 void test_fromElements_nonConflicting() { |
| 3140 Element element = ElementFactory.localVariableElement2("xx"); | 3140 Element element = ElementFactory.localVariableElement2("xx"); |
| 3141 expect(MultiplyDefinedElementImpl.fromElements(null, element, element), same
(element)); | 3141 expect(MultiplyDefinedElementImpl.fromElements(null, element, element), same
(element)); |
| 3142 } | 3142 } |
| 3143 } | 3143 } |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3479 runReflectiveTests(UnionTypeImplTest); | 3479 runReflectiveTests(UnionTypeImplTest); |
| 3480 runReflectiveTests(VoidTypeImplTest); | 3480 runReflectiveTests(VoidTypeImplTest); |
| 3481 runReflectiveTests(ClassElementImplTest); | 3481 runReflectiveTests(ClassElementImplTest); |
| 3482 runReflectiveTests(CompilationUnitElementImplTest); | 3482 runReflectiveTests(CompilationUnitElementImplTest); |
| 3483 runReflectiveTests(ElementLocationImplTest); | 3483 runReflectiveTests(ElementLocationImplTest); |
| 3484 runReflectiveTests(ElementImplTest); | 3484 runReflectiveTests(ElementImplTest); |
| 3485 runReflectiveTests(HtmlElementImplTest); | 3485 runReflectiveTests(HtmlElementImplTest); |
| 3486 runReflectiveTests(LibraryElementImplTest); | 3486 runReflectiveTests(LibraryElementImplTest); |
| 3487 runReflectiveTests(MultiplyDefinedElementImplTest); | 3487 runReflectiveTests(MultiplyDefinedElementImplTest); |
| 3488 } | 3488 } |
| OLD | NEW |