| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.element_test; | 3 library engine.element_test; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 6 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 7 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; | 8 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 9 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/source_io.dart'; | 10 import 'package:analyzer_experimental/src/generated/source_io.dart'; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 JUnitTestCase.assertFalse(first == "a;b;d"); | 41 JUnitTestCase.assertFalse(first == "a;b;d"); |
| 42 } | 42 } |
| 43 void test_equals_notEqual_sameLengths() { | 43 void test_equals_notEqual_sameLengths() { |
| 44 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c"); | 44 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c"); |
| 45 ElementLocationImpl second = new ElementLocationImpl.con2("a;b;d"); | 45 ElementLocationImpl second = new ElementLocationImpl.con2("a;b;d"); |
| 46 JUnitTestCase.assertFalse(first == second); | 46 JUnitTestCase.assertFalse(first == second); |
| 47 } | 47 } |
| 48 void test_getComponents() { | 48 void test_getComponents() { |
| 49 String encoding = "a;b;c"; | 49 String encoding = "a;b;c"; |
| 50 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); | 50 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); |
| 51 List<String> components2 = location.components; | 51 List<String> components = location.components; |
| 52 EngineTestCase.assertLength(3, components2); | 52 EngineTestCase.assertLength(3, components); |
| 53 JUnitTestCase.assertEquals("a", components2[0]); | 53 JUnitTestCase.assertEquals("a", components[0]); |
| 54 JUnitTestCase.assertEquals("b", components2[1]); | 54 JUnitTestCase.assertEquals("b", components[1]); |
| 55 JUnitTestCase.assertEquals("c", components2[2]); | 55 JUnitTestCase.assertEquals("c", components[2]); |
| 56 } | 56 } |
| 57 void test_getEncoding() { | 57 void test_getEncoding() { |
| 58 String encoding = "a;b;c;;d"; | 58 String encoding = "a;b;c;;d"; |
| 59 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); | 59 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); |
| 60 JUnitTestCase.assertEquals(encoding, location.encoding); | 60 JUnitTestCase.assertEquals(encoding, location.encoding); |
| 61 } | 61 } |
| 62 static dartSuite() { | 62 static dartSuite() { |
| 63 _ut.group('ElementLocationImplTest', () { | 63 _ut.group('ElementLocationImplTest', () { |
| 64 _ut.test('test_create_encoding', () { | 64 _ut.test('test_create_encoding', () { |
| 65 final __test = new ElementLocationImplTest(); | 65 final __test = new ElementLocationImplTest(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 LibraryElementImpl library4 = ElementFactory.library(context, "l4"); | 104 LibraryElementImpl library4 = ElementFactory.library(context, "l4"); |
| 105 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); | 105 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); |
| 106 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); | 106 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); |
| 107 List<ImportElementImpl> imports = [ElementFactory.importFor(library2, null,
[]), ElementFactory.importFor(library2, prefixB, []), ElementFactory.importFor(l
ibrary3, null, []), ElementFactory.importFor(library3, prefixA, []), ElementFact
ory.importFor(library3, prefixB, []), ElementFactory.importFor(library4, prefixA
, [])]; | 107 List<ImportElementImpl> imports = [ElementFactory.importFor(library2, null,
[]), ElementFactory.importFor(library2, prefixB, []), ElementFactory.importFor(l
ibrary3, null, []), ElementFactory.importFor(library3, prefixA, []), ElementFact
ory.importFor(library3, prefixB, []), ElementFactory.importFor(library4, prefixA
, [])]; |
| 108 library1.imports = imports; | 108 library1.imports = imports; |
| 109 List<LibraryElement> libraries = library1.importedLibraries; | 109 List<LibraryElement> libraries = library1.importedLibraries; |
| 110 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library2, library3,
library4], libraries); | 110 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library2, library3,
library4], libraries); |
| 111 } | 111 } |
| 112 void test_getPrefixes() { | 112 void test_getPrefixes() { |
| 113 AnalysisContext context = createAnalysisContext(); | 113 AnalysisContext context = createAnalysisContext(); |
| 114 LibraryElementImpl library2 = ElementFactory.library(context, "l1"); | 114 LibraryElementImpl library = ElementFactory.library(context, "l1"); |
| 115 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); | 115 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); |
| 116 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); | 116 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); |
| 117 List<ImportElementImpl> imports = [ElementFactory.importFor(ElementFactory.l
ibrary(context, "l2"), null, []), ElementFactory.importFor(ElementFactory.librar
y(context, "l3"), null, []), ElementFactory.importFor(ElementFactory.library(con
text, "l4"), prefixA, []), ElementFactory.importFor(ElementFactory.library(conte
xt, "l5"), prefixA, []), ElementFactory.importFor(ElementFactory.library(context
, "l6"), prefixB, [])]; | 117 List<ImportElementImpl> imports = [ElementFactory.importFor(ElementFactory.l
ibrary(context, "l2"), null, []), ElementFactory.importFor(ElementFactory.librar
y(context, "l3"), null, []), ElementFactory.importFor(ElementFactory.library(con
text, "l4"), prefixA, []), ElementFactory.importFor(ElementFactory.library(conte
xt, "l5"), prefixA, []), ElementFactory.importFor(ElementFactory.library(context
, "l6"), prefixB, [])]; |
| 118 library2.imports = imports; | 118 library.imports = imports; |
| 119 List<PrefixElement> prefixes2 = library2.prefixes; | 119 List<PrefixElement> prefixes = library.prefixes; |
| 120 EngineTestCase.assertLength(2, prefixes2); | 120 EngineTestCase.assertLength(2, prefixes); |
| 121 if (identical(prefixA, prefixes2[0])) { | 121 if (identical(prefixA, prefixes[0])) { |
| 122 JUnitTestCase.assertSame(prefixB, prefixes2[1]); | 122 JUnitTestCase.assertSame(prefixB, prefixes[1]); |
| 123 } else { | 123 } else { |
| 124 JUnitTestCase.assertSame(prefixB, prefixes2[0]); | 124 JUnitTestCase.assertSame(prefixB, prefixes[0]); |
| 125 JUnitTestCase.assertSame(prefixA, prefixes2[1]); | 125 JUnitTestCase.assertSame(prefixA, prefixes[1]); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 void test_isUpToDate() { | 128 void test_isUpToDate() { |
| 129 AnalysisContext context = createAnalysisContext(); | 129 AnalysisContext context = createAnalysisContext(); |
| 130 context.sourceFactory = new SourceFactory.con2([]); | 130 context.sourceFactory = new SourceFactory.con2([]); |
| 131 LibraryElement library2 = ElementFactory.library(context, "foo"); | 131 LibraryElement library = ElementFactory.library(context, "foo"); |
| 132 context.sourceFactory.setContents(library2.definingCompilationUnit.source, "
sdfsdff"); | 132 context.sourceFactory.setContents(library.definingCompilationUnit.source, "s
dfsdff"); |
| 133 JUnitTestCase.assertFalse(library2.isUpToDate2(0)); | 133 JUnitTestCase.assertFalse(library.isUpToDate2(0)); |
| 134 JUnitTestCase.assertTrue(library2.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); | 134 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); |
| 135 } | 135 } |
| 136 void test_setImports() { | 136 void test_setImports() { |
| 137 AnalysisContext context = createAnalysisContext(); | 137 AnalysisContext context = createAnalysisContext(); |
| 138 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["l1"])); | 138 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["l1"])); |
| 139 List<ImportElementImpl> expectedImports = [ElementFactory.importFor(ElementF
actory.library(context, "l2"), null, []), ElementFactory.importFor(ElementFactor
y.library(context, "l3"), null, [])]; | 139 List<ImportElementImpl> expectedImports = [ElementFactory.importFor(ElementF
actory.library(context, "l2"), null, []), ElementFactory.importFor(ElementFactor
y.library(context, "l3"), null, [])]; |
| 140 library.imports = expectedImports; | 140 library.imports = expectedImports; |
| 141 List<ImportElement> actualImports = library.imports; | 141 List<ImportElement> actualImports = library.imports; |
| 142 EngineTestCase.assertLength(expectedImports.length, actualImports); | 142 EngineTestCase.assertLength(expectedImports.length, actualImports); |
| 143 for (int i = 0; i < actualImports.length; i++) { | 143 for (int i = 0; i < actualImports.length; i++) { |
| 144 JUnitTestCase.assertSame(expectedImports[i], actualImports[i]); | 144 JUnitTestCase.assertSame(expectedImports[i], actualImports[i]); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 InterfaceType typeA = classA.type; | 351 InterfaceType typeA = classA.type; |
| 352 JUnitTestCase.assertNull(typeA.getGetter("g")); | 352 JUnitTestCase.assertNull(typeA.getGetter("g")); |
| 353 } | 353 } |
| 354 void test_getInterfaces_nonParameterized() { | 354 void test_getInterfaces_nonParameterized() { |
| 355 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 355 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 356 InterfaceType typeA = classA.type; | 356 InterfaceType typeA = classA.type; |
| 357 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 357 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 358 InterfaceType typeB = classB.type; | 358 InterfaceType typeB = classB.type; |
| 359 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 359 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 360 classC.interfaces = <InterfaceType> [typeA, typeB]; | 360 classC.interfaces = <InterfaceType> [typeA, typeB]; |
| 361 List<InterfaceType> interfaces2 = classC.type.interfaces; | 361 List<InterfaceType> interfaces = classC.type.interfaces; |
| 362 EngineTestCase.assertLength(2, interfaces2); | 362 EngineTestCase.assertLength(2, interfaces); |
| 363 if (identical(interfaces2[0], typeA)) { | 363 if (identical(interfaces[0], typeA)) { |
| 364 JUnitTestCase.assertSame(typeB, interfaces2[1]); | 364 JUnitTestCase.assertSame(typeB, interfaces[1]); |
| 365 } else { | 365 } else { |
| 366 JUnitTestCase.assertSame(typeB, interfaces2[0]); | 366 JUnitTestCase.assertSame(typeB, interfaces[0]); |
| 367 JUnitTestCase.assertSame(typeA, interfaces2[1]); | 367 JUnitTestCase.assertSame(typeA, interfaces[1]); |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 void test_getInterfaces_parameterized() { | 370 void test_getInterfaces_parameterized() { |
| 371 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 371 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 372 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 372 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 373 InterfaceType typeB = classB.type; | 373 InterfaceType typeB = classB.type; |
| 374 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 374 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 375 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; | 375 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; |
| 376 classB.interfaces = <InterfaceType> [typeAF]; | 376 classB.interfaces = <InterfaceType> [typeAF]; |
| 377 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 377 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 378 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 378 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 379 typeBI.typeArguments = <Type2> [typeI]; | 379 typeBI.typeArguments = <Type2> [typeI]; |
| 380 List<InterfaceType> interfaces2 = typeBI.interfaces; | 380 List<InterfaceType> interfaces = typeBI.interfaces; |
| 381 EngineTestCase.assertLength(1, interfaces2); | 381 EngineTestCase.assertLength(1, interfaces); |
| 382 InterfaceType result = interfaces2[0]; | 382 InterfaceType result = interfaces[0]; |
| 383 JUnitTestCase.assertSame(classA, result.element); | 383 JUnitTestCase.assertSame(classA, result.element); |
| 384 JUnitTestCase.assertSame(typeI, result.typeArguments[0]); | 384 JUnitTestCase.assertSame(typeI, result.typeArguments[0]); |
| 385 } | 385 } |
| 386 void test_getLeastUpperBound_directInterfaceCase() { | 386 void test_getLeastUpperBound_directInterfaceCase() { |
| 387 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 387 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 388 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 388 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 389 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 389 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 390 InterfaceType typeA = classA.type; | 390 InterfaceType typeA = classA.type; |
| 391 InterfaceType typeB = classB.type; | 391 InterfaceType typeB = classB.type; |
| 392 InterfaceType typeC = classC.type; | 392 InterfaceType typeC = classC.type; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 classC.interfaces = <InterfaceType> [typeA, typeA3]; | 545 classC.interfaces = <InterfaceType> [typeA, typeA3]; |
| 546 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); | 546 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); |
| 547 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); | 547 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); |
| 548 } | 548 } |
| 549 void test_getLeastUpperBound_twoComparables() { | 549 void test_getLeastUpperBound_twoComparables() { |
| 550 InterfaceType string = _typeProvider.stringType; | 550 InterfaceType string = _typeProvider.stringType; |
| 551 InterfaceType num = _typeProvider.numType; | 551 InterfaceType num = _typeProvider.numType; |
| 552 JUnitTestCase.assertEquals(_typeProvider.objectType, string.getLeastUpperBou
nd(num)); | 552 JUnitTestCase.assertEquals(_typeProvider.objectType, string.getLeastUpperBou
nd(num)); |
| 553 } | 553 } |
| 554 void test_getLeastUpperBound_typeParameters_different() { | 554 void test_getLeastUpperBound_typeParameters_different() { |
| 555 InterfaceType listType2 = _typeProvider.listType; | 555 InterfaceType listType = _typeProvider.listType; |
| 556 InterfaceType intType2 = _typeProvider.intType; | 556 InterfaceType intType = _typeProvider.intType; |
| 557 InterfaceType doubleType2 = _typeProvider.doubleType; | 557 InterfaceType doubleType = _typeProvider.doubleType; |
| 558 InterfaceType listOfIntType = listType2.substitute5(<Type2> [intType2]); | 558 InterfaceType listOfIntType = listType.substitute5(<Type2> [intType]); |
| 559 InterfaceType listOfDoubleType = listType2.substitute5(<Type2> [doubleType2]
); | 559 InterfaceType listOfDoubleType = listType.substitute5(<Type2> [doubleType]); |
| 560 JUnitTestCase.assertEquals(listType2.substitute5(<Type2> [_typeProvider.dyna
micType]), listOfIntType.getLeastUpperBound(listOfDoubleType)); | 560 JUnitTestCase.assertEquals(listType.substitute5(<Type2> [_typeProvider.dynam
icType]), listOfIntType.getLeastUpperBound(listOfDoubleType)); |
| 561 } | 561 } |
| 562 void test_getLeastUpperBound_typeParameters_same() { | 562 void test_getLeastUpperBound_typeParameters_same() { |
| 563 InterfaceType listType2 = _typeProvider.listType; | 563 InterfaceType listType = _typeProvider.listType; |
| 564 InterfaceType intType2 = _typeProvider.intType; | 564 InterfaceType intType = _typeProvider.intType; |
| 565 InterfaceType listOfIntType = listType2.substitute5(<Type2> [intType2]); | 565 InterfaceType listOfIntType = listType.substitute5(<Type2> [intType]); |
| 566 JUnitTestCase.assertEquals(listOfIntType, listOfIntType.getLeastUpperBound(l
istOfIntType)); | 566 JUnitTestCase.assertEquals(listOfIntType, listOfIntType.getLeastUpperBound(l
istOfIntType)); |
| 567 } | 567 } |
| 568 void test_getMethod_implemented() { | 568 void test_getMethod_implemented() { |
| 569 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 569 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 570 String methodName = "m"; | 570 String methodName = "m"; |
| 571 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); | 571 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); |
| 572 classA.methods = <MethodElement> [methodM]; | 572 classA.methods = <MethodElement> [methodM]; |
| 573 InterfaceType typeA = classA.type; | 573 InterfaceType typeA = classA.type; |
| 574 JUnitTestCase.assertSame(methodM, typeA.getMethod(methodName)); | 574 JUnitTestCase.assertSame(methodM, typeA.getMethod(methodName)); |
| 575 } | 575 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 void test_getSuperclass_parameterized() { | 666 void test_getSuperclass_parameterized() { |
| 667 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 667 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 668 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 668 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 669 InterfaceType typeB = classB.type; | 669 InterfaceType typeB = classB.type; |
| 670 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 670 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 671 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; | 671 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; |
| 672 classB.supertype = typeAF; | 672 classB.supertype = typeAF; |
| 673 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 673 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 674 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 674 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 675 typeBI.typeArguments = <Type2> [typeI]; | 675 typeBI.typeArguments = <Type2> [typeI]; |
| 676 InterfaceType superclass2 = typeBI.superclass; | 676 InterfaceType superclass = typeBI.superclass; |
| 677 JUnitTestCase.assertSame(classA, superclass2.element); | 677 JUnitTestCase.assertSame(classA, superclass.element); |
| 678 JUnitTestCase.assertSame(typeI, superclass2.typeArguments[0]); | 678 JUnitTestCase.assertSame(typeI, superclass.typeArguments[0]); |
| 679 } | 679 } |
| 680 void test_getTypeArguments_empty() { | 680 void test_getTypeArguments_empty() { |
| 681 InterfaceType type2 = ElementFactory.classElement2("A", []).type; | 681 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 682 EngineTestCase.assertLength(0, type2.typeArguments); | 682 EngineTestCase.assertLength(0, type.typeArguments); |
| 683 } | 683 } |
| 684 void test_isDirectSupertypeOf_extends() { | 684 void test_isDirectSupertypeOf_extends() { |
| 685 ClassElement classA = ElementFactory.classElement2("A", []); | 685 ClassElement classA = ElementFactory.classElement2("A", []); |
| 686 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 686 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 687 InterfaceType typeA = classA.type; | 687 InterfaceType typeA = classA.type; |
| 688 InterfaceType typeB = classB.type; | 688 InterfaceType typeB = classB.type; |
| 689 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); | 689 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); |
| 690 } | 690 } |
| 691 void test_isDirectSupertypeOf_false() { | 691 void test_isDirectSupertypeOf_false() { |
| 692 ClassElement classA = ElementFactory.classElement2("A", []); | 692 ClassElement classA = ElementFactory.classElement2("A", []); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 706 } | 706 } |
| 707 void test_isDirectSupertypeOf_with() { | 707 void test_isDirectSupertypeOf_with() { |
| 708 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 708 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 709 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 709 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 710 InterfaceType typeA = classA.type; | 710 InterfaceType typeA = classA.type; |
| 711 InterfaceType typeB = classB.type; | 711 InterfaceType typeB = classB.type; |
| 712 classB.mixins = <InterfaceType> [typeA]; | 712 classB.mixins = <InterfaceType> [typeA]; |
| 713 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); | 713 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); |
| 714 } | 714 } |
| 715 void test_isMoreSpecificThan_bottom() { | 715 void test_isMoreSpecificThan_bottom() { |
| 716 Type2 type2 = ElementFactory.classElement2("A", []).type; | 716 Type2 type = ElementFactory.classElement2("A", []).type; |
| 717 JUnitTestCase.assertTrue(BottomTypeImpl.instance.isMoreSpecificThan(type2)); | 717 JUnitTestCase.assertTrue(BottomTypeImpl.instance.isMoreSpecificThan(type)); |
| 718 } | 718 } |
| 719 void test_isMoreSpecificThan_covariance() { | 719 void test_isMoreSpecificThan_covariance() { |
| 720 ClassElement classA = ElementFactory.classElement2("A", ["E"]); | 720 ClassElement classA = ElementFactory.classElement2("A", ["E"]); |
| 721 ClassElement classI = ElementFactory.classElement2("I", []); | 721 ClassElement classI = ElementFactory.classElement2("I", []); |
| 722 ClassElement classJ = ElementFactory.classElement("J", classI.type, []); | 722 ClassElement classJ = ElementFactory.classElement("J", classI.type, []); |
| 723 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 723 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 724 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA); | 724 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA); |
| 725 typeAI.typeArguments = <Type2> [classI.type]; | 725 typeAI.typeArguments = <Type2> [classI.type]; |
| 726 typeAJ.typeArguments = <Type2> [classJ.type]; | 726 typeAJ.typeArguments = <Type2> [classJ.type]; |
| 727 JUnitTestCase.assertTrue(typeAJ.isMoreSpecificThan(typeAI)); | 727 JUnitTestCase.assertTrue(typeAJ.isMoreSpecificThan(typeAI)); |
| 728 JUnitTestCase.assertFalse(typeAI.isMoreSpecificThan(typeAJ)); | 728 JUnitTestCase.assertFalse(typeAI.isMoreSpecificThan(typeAJ)); |
| 729 } | 729 } |
| 730 void test_isMoreSpecificThan_directSupertype() { | 730 void test_isMoreSpecificThan_directSupertype() { |
| 731 ClassElement classA = ElementFactory.classElement2("A", []); | 731 ClassElement classA = ElementFactory.classElement2("A", []); |
| 732 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 732 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 733 InterfaceType typeA = classA.type; | 733 InterfaceType typeA = classA.type; |
| 734 InterfaceType typeB = classB.type; | 734 InterfaceType typeB = classB.type; |
| 735 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA)); | 735 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA)); |
| 736 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB)); | 736 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB)); |
| 737 } | 737 } |
| 738 void test_isMoreSpecificThan_dynamic() { | 738 void test_isMoreSpecificThan_dynamic() { |
| 739 InterfaceType type2 = ElementFactory.classElement2("A", []).type; | 739 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 740 JUnitTestCase.assertTrue(type2.isMoreSpecificThan(DynamicTypeImpl.instance))
; | 740 JUnitTestCase.assertTrue(type.isMoreSpecificThan(DynamicTypeImpl.instance)); |
| 741 } | 741 } |
| 742 void test_isMoreSpecificThan_self() { | 742 void test_isMoreSpecificThan_self() { |
| 743 InterfaceType type2 = ElementFactory.classElement2("A", []).type; | 743 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 744 JUnitTestCase.assertTrue(type2.isMoreSpecificThan(type2)); | 744 JUnitTestCase.assertTrue(type.isMoreSpecificThan(type)); |
| 745 } | 745 } |
| 746 void test_isMoreSpecificThan_transitive_interface() { | 746 void test_isMoreSpecificThan_transitive_interface() { |
| 747 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 747 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 748 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 748 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 749 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 749 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 750 classC.interfaces = <InterfaceType> [classB.type]; | 750 classC.interfaces = <InterfaceType> [classB.type]; |
| 751 InterfaceType typeA = classA.type; | 751 InterfaceType typeA = classA.type; |
| 752 InterfaceType typeC = classC.type; | 752 InterfaceType typeC = classC.type; |
| 753 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); | 753 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); |
| 754 } | 754 } |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 ClassElement classA = ElementFactory.classElement2("A", []); | 936 ClassElement classA = ElementFactory.classElement2("A", []); |
| 937 InterfaceType typeA = classA.type; | 937 InterfaceType typeA = classA.type; |
| 938 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeA)); | 938 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeA)); |
| 939 } | 939 } |
| 940 void test_lookUpGetter_implemented() { | 940 void test_lookUpGetter_implemented() { |
| 941 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 941 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 942 String getterName = "g"; | 942 String getterName = "g"; |
| 943 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); | 943 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); |
| 944 classA.accessors = <PropertyAccessorElement> [getterG]; | 944 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 945 InterfaceType typeA = classA.type; | 945 InterfaceType typeA = classA.type; |
| 946 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 946 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 947 CompilationUnitElement unit = library2.definingCompilationUnit; | 947 CompilationUnitElement unit = library.definingCompilationUnit; |
| 948 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 948 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; |
| 949 JUnitTestCase.assertSame(getterG, typeA.lookUpGetter(getterName, library2)); | 949 JUnitTestCase.assertSame(getterG, typeA.lookUpGetter(getterName, library)); |
| 950 } | 950 } |
| 951 void test_lookUpGetter_inherited() { | 951 void test_lookUpGetter_inherited() { |
| 952 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 952 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 953 String getterName = "g"; | 953 String getterName = "g"; |
| 954 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); | 954 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); |
| 955 classA.accessors = <PropertyAccessorElement> [getterG]; | 955 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 956 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 956 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 957 InterfaceType typeB = classB.type; | 957 InterfaceType typeB = classB.type; |
| 958 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 958 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 959 CompilationUnitElement unit = library2.definingCompilationUnit; | 959 CompilationUnitElement unit = library.definingCompilationUnit; |
| 960 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 960 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; |
| 961 JUnitTestCase.assertSame(getterG, typeB.lookUpGetter(getterName, library2)); | 961 JUnitTestCase.assertSame(getterG, typeB.lookUpGetter(getterName, library)); |
| 962 } | 962 } |
| 963 void test_lookUpGetter_recursive() { | 963 void test_lookUpGetter_recursive() { |
| 964 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 964 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 965 InterfaceType typeA = classA.type; | 965 InterfaceType typeA = classA.type; |
| 966 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); | 966 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 967 classA.supertype = classB.type; | 967 classA.supertype = classB.type; |
| 968 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 968 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 969 CompilationUnitElement unit = library2.definingCompilationUnit; | 969 CompilationUnitElement unit = library.definingCompilationUnit; |
| 970 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 970 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; |
| 971 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library2)); | 971 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library)); |
| 972 } | 972 } |
| 973 void test_lookUpGetter_unimplemented() { | 973 void test_lookUpGetter_unimplemented() { |
| 974 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 974 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 975 InterfaceType typeA = classA.type; | 975 InterfaceType typeA = classA.type; |
| 976 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 976 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 977 CompilationUnitElement unit = library2.definingCompilationUnit; | 977 CompilationUnitElement unit = library.definingCompilationUnit; |
| 978 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 978 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; |
| 979 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library2)); | 979 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library)); |
| 980 } | 980 } |
| 981 void test_lookUpMethod_implemented() { | 981 void test_lookUpMethod_implemented() { |
| 982 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 982 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 983 String methodName = "m"; | 983 String methodName = "m"; |
| 984 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); | 984 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); |
| 985 classA.methods = <MethodElement> [methodM]; | 985 classA.methods = <MethodElement> [methodM]; |
| 986 InterfaceType typeA = classA.type; | 986 InterfaceType typeA = classA.type; |
| 987 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 987 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 988 CompilationUnitElement unit = library2.definingCompilationUnit; | 988 CompilationUnitElement unit = library.definingCompilationUnit; |
| 989 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 989 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; |
| 990 JUnitTestCase.assertSame(methodM, typeA.lookUpMethod(methodName, library2)); | 990 JUnitTestCase.assertSame(methodM, typeA.lookUpMethod(methodName, library)); |
| 991 } | 991 } |
| 992 void test_lookUpMethod_inherited() { | 992 void test_lookUpMethod_inherited() { |
| 993 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 993 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 994 String methodName = "m"; | 994 String methodName = "m"; |
| 995 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); | 995 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); |
| 996 classA.methods = <MethodElement> [methodM]; | 996 classA.methods = <MethodElement> [methodM]; |
| 997 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 997 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 998 InterfaceType typeB = classB.type; | 998 InterfaceType typeB = classB.type; |
| 999 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 999 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1000 CompilationUnitElement unit = library2.definingCompilationUnit; | 1000 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1001 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 1001 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; |
| 1002 JUnitTestCase.assertSame(methodM, typeB.lookUpMethod(methodName, library2)); | 1002 JUnitTestCase.assertSame(methodM, typeB.lookUpMethod(methodName, library)); |
| 1003 } | 1003 } |
| 1004 void test_lookUpMethod_parameterized() { | 1004 void test_lookUpMethod_parameterized() { |
| 1005 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 1005 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 1006 Type2 typeE = classA.type.typeArguments[0]; | 1006 Type2 typeE = classA.type.typeArguments[0]; |
| 1007 String methodName = "m"; | 1007 String methodName = "m"; |
| 1008 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE,
[typeE]); | 1008 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE,
[typeE]); |
| 1009 classA.methods = <MethodElement> [methodM]; | 1009 classA.methods = <MethodElement> [methodM]; |
| 1010 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 1010 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 1011 InterfaceType typeB = classB.type; | 1011 InterfaceType typeB = classB.type; |
| 1012 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 1012 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 1013 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; | 1013 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; |
| 1014 classB.supertype = typeAF; | 1014 classB.supertype = typeAF; |
| 1015 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1015 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1016 CompilationUnitElement unit = library2.definingCompilationUnit; | 1016 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1017 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1017 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; |
| 1018 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 1018 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 1019 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 1019 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 1020 typeBI.typeArguments = <Type2> [typeI]; | 1020 typeBI.typeArguments = <Type2> [typeI]; |
| 1021 MethodElement method = typeBI.lookUpMethod(methodName, library2); | 1021 MethodElement method = typeBI.lookUpMethod(methodName, library); |
| 1022 JUnitTestCase.assertNotNull(method); | 1022 JUnitTestCase.assertNotNull(method); |
| 1023 FunctionType methodType = method.type; | 1023 FunctionType methodType = method.type; |
| 1024 JUnitTestCase.assertSame(typeI, methodType.returnType); | 1024 JUnitTestCase.assertSame(typeI, methodType.returnType); |
| 1025 List<Type2> parameterTypes = methodType.normalParameterTypes; | 1025 List<Type2> parameterTypes = methodType.normalParameterTypes; |
| 1026 EngineTestCase.assertLength(1, parameterTypes); | 1026 EngineTestCase.assertLength(1, parameterTypes); |
| 1027 JUnitTestCase.assertSame(typeI, parameterTypes[0]); | 1027 JUnitTestCase.assertSame(typeI, parameterTypes[0]); |
| 1028 } | 1028 } |
| 1029 void test_lookUpMethod_recursive() { | 1029 void test_lookUpMethod_recursive() { |
| 1030 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1030 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1031 InterfaceType typeA = classA.type; | 1031 InterfaceType typeA = classA.type; |
| 1032 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); | 1032 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 1033 classA.supertype = classB.type; | 1033 classA.supertype = classB.type; |
| 1034 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1034 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1035 CompilationUnitElement unit = library2.definingCompilationUnit; | 1035 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1036 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 1036 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; |
| 1037 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library2)); | 1037 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library)); |
| 1038 } | 1038 } |
| 1039 void test_lookUpMethod_unimplemented() { | 1039 void test_lookUpMethod_unimplemented() { |
| 1040 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1040 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1041 InterfaceType typeA = classA.type; | 1041 InterfaceType typeA = classA.type; |
| 1042 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1042 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1043 CompilationUnitElement unit = library2.definingCompilationUnit; | 1043 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1044 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1044 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; |
| 1045 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library2)); | 1045 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library)); |
| 1046 } | 1046 } |
| 1047 void test_lookUpSetter_implemented() { | 1047 void test_lookUpSetter_implemented() { |
| 1048 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1048 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1049 String setterName = "s"; | 1049 String setterName = "s"; |
| 1050 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); | 1050 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); |
| 1051 classA.accessors = <PropertyAccessorElement> [setterS]; | 1051 classA.accessors = <PropertyAccessorElement> [setterS]; |
| 1052 InterfaceType typeA = classA.type; | 1052 InterfaceType typeA = classA.type; |
| 1053 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1053 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1054 CompilationUnitElement unit = library2.definingCompilationUnit; | 1054 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1055 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1055 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; |
| 1056 JUnitTestCase.assertSame(setterS, typeA.lookUpSetter(setterName, library2)); | 1056 JUnitTestCase.assertSame(setterS, typeA.lookUpSetter(setterName, library)); |
| 1057 } | 1057 } |
| 1058 void test_lookUpSetter_inherited() { | 1058 void test_lookUpSetter_inherited() { |
| 1059 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1059 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1060 String setterName = "g"; | 1060 String setterName = "g"; |
| 1061 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); | 1061 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); |
| 1062 classA.accessors = <PropertyAccessorElement> [setterS]; | 1062 classA.accessors = <PropertyAccessorElement> [setterS]; |
| 1063 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1063 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1064 InterfaceType typeB = classB.type; | 1064 InterfaceType typeB = classB.type; |
| 1065 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1065 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1066 CompilationUnitElement unit = library2.definingCompilationUnit; | 1066 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1067 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 1067 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; |
| 1068 JUnitTestCase.assertSame(setterS, typeB.lookUpSetter(setterName, library2)); | 1068 JUnitTestCase.assertSame(setterS, typeB.lookUpSetter(setterName, library)); |
| 1069 } | 1069 } |
| 1070 void test_lookUpSetter_recursive() { | 1070 void test_lookUpSetter_recursive() { |
| 1071 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1071 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1072 InterfaceType typeA = classA.type; | 1072 InterfaceType typeA = classA.type; |
| 1073 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); | 1073 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 1074 classA.supertype = classB.type; | 1074 classA.supertype = classB.type; |
| 1075 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1075 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1076 CompilationUnitElement unit = library2.definingCompilationUnit; | 1076 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1077 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 1077 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; |
| 1078 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library2)); | 1078 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); |
| 1079 } | 1079 } |
| 1080 void test_lookUpSetter_unimplemented() { | 1080 void test_lookUpSetter_unimplemented() { |
| 1081 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1081 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1082 InterfaceType typeA = classA.type; | 1082 InterfaceType typeA = classA.type; |
| 1083 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1083 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1084 CompilationUnitElement unit = library2.definingCompilationUnit; | 1084 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1085 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1085 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; |
| 1086 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library2)); | 1086 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); |
| 1087 } | 1087 } |
| 1088 void test_setTypeArguments() { | 1088 void test_setTypeArguments() { |
| 1089 InterfaceTypeImpl type2 = ElementFactory.classElement2("A", []).type as Inte
rfaceTypeImpl; | 1089 InterfaceTypeImpl type = ElementFactory.classElement2("A", []).type as Inter
faceTypeImpl; |
| 1090 List<Type2> typeArguments = <Type2> [ElementFactory.classElement2("B", []).t
ype, ElementFactory.classElement2("C", []).type]; | 1090 List<Type2> typeArguments = <Type2> [ElementFactory.classElement2("B", []).t
ype, ElementFactory.classElement2("C", []).type]; |
| 1091 type2.typeArguments = typeArguments; | 1091 type.typeArguments = typeArguments; |
| 1092 JUnitTestCase.assertEquals(typeArguments, type2.typeArguments); | 1092 JUnitTestCase.assertEquals(typeArguments, type.typeArguments); |
| 1093 } | 1093 } |
| 1094 void test_substitute_equal() { | 1094 void test_substitute_equal() { |
| 1095 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1095 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1096 TypeVariableElementImpl parameterElement = new TypeVariableElementImpl(ASTFa
ctory.identifier3("E")); | 1096 TypeVariableElementImpl parameterElement = new TypeVariableElementImpl(ASTFa
ctory.identifier3("E")); |
| 1097 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); | 1097 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); |
| 1098 TypeVariableTypeImpl parameter = new TypeVariableTypeImpl(parameterElement); | 1098 TypeVariableTypeImpl parameter = new TypeVariableTypeImpl(parameterElement); |
| 1099 type.typeArguments = <Type2> [parameter]; | 1099 type.typeArguments = <Type2> [parameter]; |
| 1100 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; | 1100 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; |
| 1101 InterfaceType result = type.substitute2(<Type2> [argumentType], <Type2> [par
ameter]); | 1101 InterfaceType result = type.substitute2(<Type2> [argumentType], <Type2> [par
ameter]); |
| 1102 JUnitTestCase.assertEquals(classA, result.element); | 1102 JUnitTestCase.assertEquals(classA, result.element); |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 typeArguments[i] = new TypeVariableTypeImpl(variable); | 1560 typeArguments[i] = new TypeVariableTypeImpl(variable); |
| 1561 variable.type = typeArguments[i]; | 1561 variable.type = typeArguments[i]; |
| 1562 } | 1562 } |
| 1563 element.typeVariables = typeVariables; | 1563 element.typeVariables = typeVariables; |
| 1564 type.typeArguments = typeArguments; | 1564 type.typeArguments = typeArguments; |
| 1565 } | 1565 } |
| 1566 return element; | 1566 return element; |
| 1567 } | 1567 } |
| 1568 static ClassElementImpl classElement2(String typeName, List<String> parameterN
ames) => classElement(typeName, object.type, parameterNames); | 1568 static ClassElementImpl classElement2(String typeName, List<String> parameterN
ames) => classElement(typeName, object.type, parameterNames); |
| 1569 static ConstructorElementImpl constructorElement(ClassElement clazz, String na
me) { | 1569 static ConstructorElementImpl constructorElement(ClassElement clazz, String na
me) { |
| 1570 Type2 type2 = clazz.type; | 1570 Type2 type = clazz.type; |
| 1571 ConstructorElementImpl constructor = new ConstructorElementImpl(name == null
? null : ASTFactory.identifier3(name)); | 1571 ConstructorElementImpl constructor = new ConstructorElementImpl(name == null
? null : ASTFactory.identifier3(name)); |
| 1572 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); | 1572 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); |
| 1573 constructorType.normalParameterTypes = <Type2> [type2]; | 1573 constructorType.normalParameterTypes = <Type2> [type]; |
| 1574 constructorType.returnType = type2; | 1574 constructorType.returnType = type; |
| 1575 constructor.type = constructorType; | 1575 constructor.type = constructorType; |
| 1576 return constructor; | 1576 return constructor; |
| 1577 } | 1577 } |
| 1578 static ExportElementImpl exportFor(LibraryElement exportedLibrary2, List<Names
paceCombinator> combinators2) { | 1578 static ExportElementImpl exportFor(LibraryElement exportedLibrary2, List<Names
paceCombinator> combinators2) { |
| 1579 ExportElementImpl spec = new ExportElementImpl(); | 1579 ExportElementImpl spec = new ExportElementImpl(); |
| 1580 spec.exportedLibrary = exportedLibrary2; | 1580 spec.exportedLibrary = exportedLibrary2; |
| 1581 spec.combinators = combinators2; | 1581 spec.combinators = combinators2; |
| 1582 return spec; | 1582 return spec; |
| 1583 } | 1583 } |
| 1584 static FieldElementImpl fieldElement(String name, bool isStatic, bool isFinal,
bool isConst, Type2 type2) { | 1584 static FieldElementImpl fieldElement(String name, bool isStatic, bool isFinal,
bool isConst, Type2 type2) { |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; | 1904 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; |
| 1905 JUnitTestCase.assertTrue(classA.hasNonFinalField()); | 1905 JUnitTestCase.assertTrue(classA.hasNonFinalField()); |
| 1906 } | 1906 } |
| 1907 void test_hasNonFinalField_true_inherited() { | 1907 void test_hasNonFinalField_true_inherited() { |
| 1908 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1908 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1909 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1909 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1910 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; | 1910 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; |
| 1911 JUnitTestCase.assertTrue(classB.hasNonFinalField()); | 1911 JUnitTestCase.assertTrue(classB.hasNonFinalField()); |
| 1912 } | 1912 } |
| 1913 void test_lookUpGetter_declared() { | 1913 void test_lookUpGetter_declared() { |
| 1914 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1914 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1915 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1915 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1916 String getterName = "g"; | 1916 String getterName = "g"; |
| 1917 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); | 1917 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); |
| 1918 classA.accessors = <PropertyAccessorElement> [getter]; | 1918 classA.accessors = <PropertyAccessorElement> [getter]; |
| 1919 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 1919 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; |
| 1920 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library2)); | 1920 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library)); |
| 1921 } | 1921 } |
| 1922 void test_lookUpGetter_inherited() { | 1922 void test_lookUpGetter_inherited() { |
| 1923 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1923 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1924 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1924 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1925 String getterName = "g"; | 1925 String getterName = "g"; |
| 1926 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); | 1926 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); |
| 1927 classA.accessors = <PropertyAccessorElement> [getter]; | 1927 classA.accessors = <PropertyAccessorElement> [getter]; |
| 1928 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1928 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1929 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; | 1929 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; |
| 1930 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library2)); | 1930 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library)); |
| 1931 } | 1931 } |
| 1932 void test_lookUpGetter_undeclared() { | 1932 void test_lookUpGetter_undeclared() { |
| 1933 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1933 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1934 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1934 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1935 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 1935 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; |
| 1936 JUnitTestCase.assertNull(classA.lookUpGetter("g", library2)); | 1936 JUnitTestCase.assertNull(classA.lookUpGetter("g", library)); |
| 1937 } | 1937 } |
| 1938 void test_lookUpGetter_undeclared_recursive() { | 1938 void test_lookUpGetter_undeclared_recursive() { |
| 1939 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1939 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1940 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1940 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1941 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1941 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1942 classA.supertype = classB.type; | 1942 classA.supertype = classB.type; |
| 1943 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; | 1943 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; |
| 1944 JUnitTestCase.assertNull(classA.lookUpGetter("g", library2)); | 1944 JUnitTestCase.assertNull(classA.lookUpGetter("g", library)); |
| 1945 } | 1945 } |
| 1946 void test_lookUpMethod_declared() { | 1946 void test_lookUpMethod_declared() { |
| 1947 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1947 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1948 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1948 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1949 String methodName = "m"; | 1949 String methodName = "m"; |
| 1950 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 1950 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
| 1951 classA.methods = <MethodElement> [method]; | 1951 classA.methods = <MethodElement> [method]; |
| 1952 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 1952 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; |
| 1953 JUnitTestCase.assertSame(method, classA.lookUpMethod(methodName, library2)); | 1953 JUnitTestCase.assertSame(method, classA.lookUpMethod(methodName, library)); |
| 1954 } | 1954 } |
| 1955 void test_lookUpMethod_inherited() { | 1955 void test_lookUpMethod_inherited() { |
| 1956 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1956 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1957 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1957 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1958 String methodName = "m"; | 1958 String methodName = "m"; |
| 1959 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 1959 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
| 1960 classA.methods = <MethodElement> [method]; | 1960 classA.methods = <MethodElement> [method]; |
| 1961 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1961 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1962 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; | 1962 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; |
| 1963 JUnitTestCase.assertSame(method, classB.lookUpMethod(methodName, library2)); | 1963 JUnitTestCase.assertSame(method, classB.lookUpMethod(methodName, library)); |
| 1964 } | 1964 } |
| 1965 void test_lookUpMethod_undeclared() { | 1965 void test_lookUpMethod_undeclared() { |
| 1966 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1966 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1967 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1967 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1968 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 1968 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; |
| 1969 JUnitTestCase.assertNull(classA.lookUpMethod("m", library2)); | 1969 JUnitTestCase.assertNull(classA.lookUpMethod("m", library)); |
| 1970 } | 1970 } |
| 1971 void test_lookUpMethod_undeclared_recursive() { | 1971 void test_lookUpMethod_undeclared_recursive() { |
| 1972 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1972 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1973 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1973 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1974 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1974 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1975 classA.supertype = classB.type; | 1975 classA.supertype = classB.type; |
| 1976 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; | 1976 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; |
| 1977 JUnitTestCase.assertNull(classA.lookUpMethod("m", library2)); | 1977 JUnitTestCase.assertNull(classA.lookUpMethod("m", library)); |
| 1978 } | 1978 } |
| 1979 void test_lookUpSetter_declared() { | 1979 void test_lookUpSetter_declared() { |
| 1980 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1980 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1981 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1981 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1982 String setterName = "s"; | 1982 String setterName = "s"; |
| 1983 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); | 1983 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); |
| 1984 classA.accessors = <PropertyAccessorElement> [setter]; | 1984 classA.accessors = <PropertyAccessorElement> [setter]; |
| 1985 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 1985 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; |
| 1986 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library2)); | 1986 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library)); |
| 1987 } | 1987 } |
| 1988 void test_lookUpSetter_inherited() { | 1988 void test_lookUpSetter_inherited() { |
| 1989 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1989 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1990 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1990 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1991 String setterName = "s"; | 1991 String setterName = "s"; |
| 1992 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); | 1992 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); |
| 1993 classA.accessors = <PropertyAccessorElement> [setter]; | 1993 classA.accessors = <PropertyAccessorElement> [setter]; |
| 1994 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1994 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1995 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; | 1995 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; |
| 1996 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library2)); | 1996 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library)); |
| 1997 } | 1997 } |
| 1998 void test_lookUpSetter_undeclared() { | 1998 void test_lookUpSetter_undeclared() { |
| 1999 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1999 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2000 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2000 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2001 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 2001 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; |
| 2002 JUnitTestCase.assertNull(classA.lookUpSetter("s", library2)); | 2002 JUnitTestCase.assertNull(classA.lookUpSetter("s", library)); |
| 2003 } | 2003 } |
| 2004 void test_lookUpSetter_undeclared_recursive() { | 2004 void test_lookUpSetter_undeclared_recursive() { |
| 2005 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 2005 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2006 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2006 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2007 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2007 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 2008 classA.supertype = classB.type; | 2008 classA.supertype = classB.type; |
| 2009 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; | 2009 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; |
| 2010 JUnitTestCase.assertNull(classA.lookUpSetter("s", library2)); | 2010 JUnitTestCase.assertNull(classA.lookUpSetter("s", library)); |
| 2011 } | 2011 } |
| 2012 static dartSuite() { | 2012 static dartSuite() { |
| 2013 _ut.group('ClassElementImplTest', () { | 2013 _ut.group('ClassElementImplTest', () { |
| 2014 _ut.test('test_getAllSupertypes_interface', () { | 2014 _ut.test('test_getAllSupertypes_interface', () { |
| 2015 final __test = new ClassElementImplTest(); | 2015 final __test = new ClassElementImplTest(); |
| 2016 runJUnitTest(__test, __test.test_getAllSupertypes_interface); | 2016 runJUnitTest(__test, __test.test_getAllSupertypes_interface); |
| 2017 }); | 2017 }); |
| 2018 _ut.test('test_getAllSupertypes_mixins', () { | 2018 _ut.test('test_getAllSupertypes_mixins', () { |
| 2019 final __test = new ClassElementImplTest(); | 2019 final __test = new ClassElementImplTest(); |
| 2020 runJUnitTest(__test, __test.test_getAllSupertypes_mixins); | 2020 runJUnitTest(__test, __test.test_getAllSupertypes_mixins); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2097 }); | 2097 }); |
| 2098 _ut.test('test_lookUpSetter_undeclared_recursive', () { | 2098 _ut.test('test_lookUpSetter_undeclared_recursive', () { |
| 2099 final __test = new ClassElementImplTest(); | 2099 final __test = new ClassElementImplTest(); |
| 2100 runJUnitTest(__test, __test.test_lookUpSetter_undeclared_recursive); | 2100 runJUnitTest(__test, __test.test_lookUpSetter_undeclared_recursive); |
| 2101 }); | 2101 }); |
| 2102 }); | 2102 }); |
| 2103 } | 2103 } |
| 2104 } | 2104 } |
| 2105 class ElementImplTest extends EngineTestCase { | 2105 class ElementImplTest extends EngineTestCase { |
| 2106 void test_equals() { | 2106 void test_equals() { |
| 2107 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 2107 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2108 ClassElementImpl classElement = ElementFactory.classElement2("C", []); | 2108 ClassElementImpl classElement = ElementFactory.classElement2("C", []); |
| 2109 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classElement]; | 2109 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classElement]; |
| 2110 FieldElement field = ElementFactory.fieldElement("next", false, false, false
, classElement.type); | 2110 FieldElement field = ElementFactory.fieldElement("next", false, false, false
, classElement.type); |
| 2111 classElement.fields = <FieldElement> [field]; | 2111 classElement.fields = <FieldElement> [field]; |
| 2112 JUnitTestCase.assertTrue(field == field); | 2112 JUnitTestCase.assertTrue(field == field); |
| 2113 JUnitTestCase.assertFalse(field == field.getter); | 2113 JUnitTestCase.assertFalse(field == field.getter); |
| 2114 JUnitTestCase.assertFalse(field == field.setter); | 2114 JUnitTestCase.assertFalse(field == field.setter); |
| 2115 JUnitTestCase.assertFalse(field.getter == field.setter); | 2115 JUnitTestCase.assertFalse(field.getter == field.setter); |
| 2116 } | 2116 } |
| 2117 void test_isAccessibleIn_private_differentLibrary() { | 2117 void test_isAccessibleIn_private_differentLibrary() { |
| 2118 AnalysisContextImpl context = createAnalysisContext(); | 2118 AnalysisContextImpl context = createAnalysisContext(); |
| 2119 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); | 2119 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); |
| 2120 ClassElement classElement = ElementFactory.classElement2("_C", []); | 2120 ClassElement classElement = ElementFactory.classElement2("_C", []); |
| 2121 ((library1.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classElement]; | 2121 ((library1.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classElement]; |
| 2122 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); | 2122 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); |
| 2123 JUnitTestCase.assertFalse(classElement.isAccessibleIn(library2)); | 2123 JUnitTestCase.assertFalse(classElement.isAccessibleIn(library2)); |
| 2124 } | 2124 } |
| 2125 void test_isAccessibleIn_private_sameLibrary() { | 2125 void test_isAccessibleIn_private_sameLibrary() { |
| 2126 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 2126 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2127 ClassElement classElement = ElementFactory.classElement2("_C", []); | 2127 ClassElement classElement = ElementFactory.classElement2("_C", []); |
| 2128 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classElement]; | 2128 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classElement]; |
| 2129 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2)); | 2129 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library)); |
| 2130 } | 2130 } |
| 2131 void test_isAccessibleIn_public_differentLibrary() { | 2131 void test_isAccessibleIn_public_differentLibrary() { |
| 2132 AnalysisContextImpl context = createAnalysisContext(); | 2132 AnalysisContextImpl context = createAnalysisContext(); |
| 2133 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); | 2133 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); |
| 2134 ClassElement classElement = ElementFactory.classElement2("C", []); | 2134 ClassElement classElement = ElementFactory.classElement2("C", []); |
| 2135 ((library1.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classElement]; | 2135 ((library1.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classElement]; |
| 2136 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); | 2136 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); |
| 2137 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2)); | 2137 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2)); |
| 2138 } | 2138 } |
| 2139 void test_isAccessibleIn_public_sameLibrary() { | 2139 void test_isAccessibleIn_public_sameLibrary() { |
| 2140 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 2140 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2141 ClassElement classElement = ElementFactory.classElement2("C", []); | 2141 ClassElement classElement = ElementFactory.classElement2("C", []); |
| 2142 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classElement]; | 2142 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classElement]; |
| 2143 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2)); | 2143 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library)); |
| 2144 } | 2144 } |
| 2145 static dartSuite() { | 2145 static dartSuite() { |
| 2146 _ut.group('ElementImplTest', () { | 2146 _ut.group('ElementImplTest', () { |
| 2147 _ut.test('test_equals', () { | 2147 _ut.test('test_equals', () { |
| 2148 final __test = new ElementImplTest(); | 2148 final __test = new ElementImplTest(); |
| 2149 runJUnitTest(__test, __test.test_equals); | 2149 runJUnitTest(__test, __test.test_equals); |
| 2150 }); | 2150 }); |
| 2151 _ut.test('test_isAccessibleIn_private_differentLibrary', () { | 2151 _ut.test('test_isAccessibleIn_private_differentLibrary', () { |
| 2152 final __test = new ElementImplTest(); | 2152 final __test = new ElementImplTest(); |
| 2153 runJUnitTest(__test, __test.test_isAccessibleIn_private_differentLibrary
); | 2153 runJUnitTest(__test, __test.test_isAccessibleIn_private_differentLibrary
); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2181 Map<String, Type2> types = type.namedParameterTypes; | 2181 Map<String, Type2> types = type.namedParameterTypes; |
| 2182 EngineTestCase.assertSize2(0, types); | 2182 EngineTestCase.assertSize2(0, types); |
| 2183 } | 2183 } |
| 2184 void test_getNormalParameterTypes() { | 2184 void test_getNormalParameterTypes() { |
| 2185 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2185 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2186 List<Type2> types = type.normalParameterTypes; | 2186 List<Type2> types = type.normalParameterTypes; |
| 2187 EngineTestCase.assertLength(0, types); | 2187 EngineTestCase.assertLength(0, types); |
| 2188 } | 2188 } |
| 2189 void test_getReturnType() { | 2189 void test_getReturnType() { |
| 2190 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2190 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2191 Type2 returnType2 = type.returnType; | 2191 Type2 returnType = type.returnType; |
| 2192 JUnitTestCase.assertEquals(VoidTypeImpl.instance, returnType2); | 2192 JUnitTestCase.assertEquals(VoidTypeImpl.instance, returnType); |
| 2193 } | 2193 } |
| 2194 void test_getTypeArguments() { | 2194 void test_getTypeArguments() { |
| 2195 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2195 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2196 List<Type2> types = type.typeArguments; | 2196 List<Type2> types = type.typeArguments; |
| 2197 EngineTestCase.assertLength(0, types); | 2197 EngineTestCase.assertLength(0, types); |
| 2198 } | 2198 } |
| 2199 void test_hashCode_element() { | 2199 void test_hashCode_element() { |
| 2200 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2200 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2201 type.hashCode; | 2201 type.hashCode; |
| 2202 } | 2202 } |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2415 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2415 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2416 List<Type2> expectedTypes = <Type2> [new InterfaceTypeImpl.con1(new ClassEle
mentImpl(ASTFactory.identifier3("C")))]; | 2416 List<Type2> expectedTypes = <Type2> [new InterfaceTypeImpl.con1(new ClassEle
mentImpl(ASTFactory.identifier3("C")))]; |
| 2417 type.normalParameterTypes = expectedTypes; | 2417 type.normalParameterTypes = expectedTypes; |
| 2418 List<Type2> types = type.normalParameterTypes; | 2418 List<Type2> types = type.normalParameterTypes; |
| 2419 JUnitTestCase.assertEquals(expectedTypes, types); | 2419 JUnitTestCase.assertEquals(expectedTypes, types); |
| 2420 } | 2420 } |
| 2421 void test_setReturnType() { | 2421 void test_setReturnType() { |
| 2422 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2422 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2423 Type2 expectedType = new InterfaceTypeImpl.con1(new ClassElementImpl(ASTFact
ory.identifier3("C"))); | 2423 Type2 expectedType = new InterfaceTypeImpl.con1(new ClassElementImpl(ASTFact
ory.identifier3("C"))); |
| 2424 type.returnType = expectedType; | 2424 type.returnType = expectedType; |
| 2425 Type2 returnType2 = type.returnType; | 2425 Type2 returnType = type.returnType; |
| 2426 JUnitTestCase.assertEquals(expectedType, returnType2); | 2426 JUnitTestCase.assertEquals(expectedType, returnType); |
| 2427 } | 2427 } |
| 2428 void test_setTypeArguments() { | 2428 void test_setTypeArguments() { |
| 2429 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2429 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2430 Type2 expectedType = new TypeVariableTypeImpl(new TypeVariableElementImpl(AS
TFactory.identifier3("C"))); | 2430 Type2 expectedType = new TypeVariableTypeImpl(new TypeVariableElementImpl(AS
TFactory.identifier3("C"))); |
| 2431 type.typeArguments = <Type2> [expectedType]; | 2431 type.typeArguments = <Type2> [expectedType]; |
| 2432 List<Type2> arguments = type.typeArguments; | 2432 List<Type2> arguments = type.typeArguments; |
| 2433 EngineTestCase.assertLength(1, arguments); | 2433 EngineTestCase.assertLength(1, arguments); |
| 2434 JUnitTestCase.assertEquals(expectedType, arguments[0]); | 2434 JUnitTestCase.assertEquals(expectedType, arguments[0]); |
| 2435 } | 2435 } |
| 2436 void test_substitute2_equal() { | 2436 void test_substitute2_equal() { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2671 main() { | 2671 main() { |
| 2672 ElementKindTest.dartSuite(); | 2672 ElementKindTest.dartSuite(); |
| 2673 FunctionTypeImplTest.dartSuite(); | 2673 FunctionTypeImplTest.dartSuite(); |
| 2674 InterfaceTypeImplTest.dartSuite(); | 2674 InterfaceTypeImplTest.dartSuite(); |
| 2675 TypeVariableTypeImplTest.dartSuite(); | 2675 TypeVariableTypeImplTest.dartSuite(); |
| 2676 ClassElementImplTest.dartSuite(); | 2676 ClassElementImplTest.dartSuite(); |
| 2677 ElementLocationImplTest.dartSuite(); | 2677 ElementLocationImplTest.dartSuite(); |
| 2678 ElementImplTest.dartSuite(); | 2678 ElementImplTest.dartSuite(); |
| 2679 LibraryElementImplTest.dartSuite(); | 2679 LibraryElementImplTest.dartSuite(); |
| 2680 } | 2680 } |
| OLD | NEW |