Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: pkg/analyzer_experimental/test/generated/element_test.dart

Issue 14161021: Generate unique names less aggressively. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 3
4 library engine.element_test; 4 library engine.element_test;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:io'; 7 import 'dart:io';
8 import 'package:analyzer_experimental/src/generated/java_core.dart'; 8 import 'package:analyzer_experimental/src/generated/java_core.dart';
9 import 'package:analyzer_experimental/src/generated/java_engine.dart'; 9 import 'package:analyzer_experimental/src/generated/java_engine.dart';
10 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; 10 import 'package:analyzer_experimental/src/generated/java_engine_io.dart';
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 JUnitTestCase.assertFalse(first == "a;b;d"); 44 JUnitTestCase.assertFalse(first == "a;b;d");
45 } 45 }
46 void test_equals_notEqual_sameLengths() { 46 void test_equals_notEqual_sameLengths() {
47 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c"); 47 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c");
48 ElementLocationImpl second = new ElementLocationImpl.con2("a;b;d"); 48 ElementLocationImpl second = new ElementLocationImpl.con2("a;b;d");
49 JUnitTestCase.assertFalse(first == second); 49 JUnitTestCase.assertFalse(first == second);
50 } 50 }
51 void test_getComponents() { 51 void test_getComponents() {
52 String encoding = "a;b;c"; 52 String encoding = "a;b;c";
53 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); 53 ElementLocationImpl location = new ElementLocationImpl.con2(encoding);
54 List<String> components3 = location.components; 54 List<String> components2 = location.components;
55 EngineTestCase.assertLength(3, components3); 55 EngineTestCase.assertLength(3, components2);
56 JUnitTestCase.assertEquals("a", components3[0]); 56 JUnitTestCase.assertEquals("a", components2[0]);
57 JUnitTestCase.assertEquals("b", components3[1]); 57 JUnitTestCase.assertEquals("b", components2[1]);
58 JUnitTestCase.assertEquals("c", components3[2]); 58 JUnitTestCase.assertEquals("c", components2[2]);
59 } 59 }
60 void test_getEncoding() { 60 void test_getEncoding() {
61 String encoding = "a;b;c;;d"; 61 String encoding = "a;b;c;;d";
62 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); 62 ElementLocationImpl location = new ElementLocationImpl.con2(encoding);
63 JUnitTestCase.assertEquals(encoding, location.encoding); 63 JUnitTestCase.assertEquals(encoding, location.encoding);
64 } 64 }
65 static dartSuite() { 65 static dartSuite() {
66 _ut.group('ElementLocationImplTest', () { 66 _ut.group('ElementLocationImplTest', () {
67 _ut.test('test_create_encoding', () { 67 _ut.test('test_create_encoding', () {
68 final __test = new ElementLocationImplTest(); 68 final __test = new ElementLocationImplTest();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 LibraryElementImpl library4 = ElementFactory.library(context, "l4"); 107 LibraryElementImpl library4 = ElementFactory.library(context, "l4");
108 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); 108 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a"));
109 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); 109 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b"));
110 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 , [])]; 110 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 , [])];
111 library1.imports = imports; 111 library1.imports = imports;
112 List<LibraryElement> libraries = library1.importedLibraries; 112 List<LibraryElement> libraries = library1.importedLibraries;
113 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library2, library3, library4], libraries); 113 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library2, library3, library4], libraries);
114 } 114 }
115 void test_getPrefixes() { 115 void test_getPrefixes() {
116 AnalysisContext context = createAnalysisContext(); 116 AnalysisContext context = createAnalysisContext();
117 LibraryElementImpl library18 = ElementFactory.library(context, "l1"); 117 LibraryElementImpl library2 = ElementFactory.library(context, "l1");
118 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); 118 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a"));
119 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); 119 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b"));
120 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, [])]; 120 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, [])];
121 library18.imports = imports; 121 library2.imports = imports;
122 List<PrefixElement> prefixes2 = library18.prefixes; 122 List<PrefixElement> prefixes2 = library2.prefixes;
123 EngineTestCase.assertLength(2, prefixes2); 123 EngineTestCase.assertLength(2, prefixes2);
124 if (identical(prefixA, prefixes2[0])) { 124 if (identical(prefixA, prefixes2[0])) {
125 JUnitTestCase.assertSame(prefixB, prefixes2[1]); 125 JUnitTestCase.assertSame(prefixB, prefixes2[1]);
126 } else { 126 } else {
127 JUnitTestCase.assertSame(prefixB, prefixes2[0]); 127 JUnitTestCase.assertSame(prefixB, prefixes2[0]);
128 JUnitTestCase.assertSame(prefixA, prefixes2[1]); 128 JUnitTestCase.assertSame(prefixA, prefixes2[1]);
129 } 129 }
130 } 130 }
131 void test_isUpToDate() { 131 void test_isUpToDate() {
132 AnalysisContext context = createAnalysisContext(); 132 AnalysisContext context = createAnalysisContext();
133 context.sourceFactory = new SourceFactory.con2([]); 133 context.sourceFactory = new SourceFactory.con2([]);
134 LibraryElement library19 = ElementFactory.library(context, "foo"); 134 LibraryElement library2 = ElementFactory.library(context, "foo");
135 context.sourceFactory.setContents(library19.definingCompilationUnit.source, "sdfsdff"); 135 context.sourceFactory.setContents(library2.definingCompilationUnit.source, " sdfsdff");
136 JUnitTestCase.assertFalse(library19.isUpToDate2(0)); 136 JUnitTestCase.assertFalse(library2.isUpToDate2(0));
137 JUnitTestCase.assertTrue(library19.isUpToDate2(JavaSystem.currentTimeMillis( ) + 1000)); 137 JUnitTestCase.assertTrue(library2.isUpToDate2(JavaSystem.currentTimeMillis() + 1000));
138 } 138 }
139 void test_setImports() { 139 void test_setImports() {
140 AnalysisContext context = createAnalysisContext(); 140 AnalysisContext context = createAnalysisContext();
141 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr aryIdentifier2(["l1"])); 141 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr aryIdentifier2(["l1"]));
142 List<ImportElementImpl> expectedImports = [ElementFactory.importFor(ElementF actory.library(context, "l2"), null, []), ElementFactory.importFor(ElementFactor y.library(context, "l3"), null, [])]; 142 List<ImportElementImpl> expectedImports = [ElementFactory.importFor(ElementF actory.library(context, "l2"), null, []), ElementFactory.importFor(ElementFactor y.library(context, "l3"), null, [])];
143 library.imports = expectedImports; 143 library.imports = expectedImports;
144 List<ImportElement> actualImports = library.imports; 144 List<ImportElement> actualImports = library.imports;
145 EngineTestCase.assertLength(expectedImports.length, actualImports); 145 EngineTestCase.assertLength(expectedImports.length, actualImports);
146 for (int i = 0; i < actualImports.length; i++) { 146 for (int i = 0; i < actualImports.length; i++) {
147 JUnitTestCase.assertSame(expectedImports[i], actualImports[i]); 147 JUnitTestCase.assertSame(expectedImports[i], actualImports[i]);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 InterfaceType typeA = classA.type; 350 InterfaceType typeA = classA.type;
351 JUnitTestCase.assertNull(typeA.getGetter("g")); 351 JUnitTestCase.assertNull(typeA.getGetter("g"));
352 } 352 }
353 void test_getInterfaces_nonParameterized() { 353 void test_getInterfaces_nonParameterized() {
354 ClassElementImpl classA = ElementFactory.classElement2("A", []); 354 ClassElementImpl classA = ElementFactory.classElement2("A", []);
355 InterfaceType typeA = classA.type; 355 InterfaceType typeA = classA.type;
356 ClassElementImpl classB = ElementFactory.classElement2("B", []); 356 ClassElementImpl classB = ElementFactory.classElement2("B", []);
357 InterfaceType typeB = classB.type; 357 InterfaceType typeB = classB.type;
358 ClassElementImpl classC = ElementFactory.classElement2("C", []); 358 ClassElementImpl classC = ElementFactory.classElement2("C", []);
359 classC.interfaces = <InterfaceType> [typeA, typeB]; 359 classC.interfaces = <InterfaceType> [typeA, typeB];
360 List<InterfaceType> interfaces7 = classC.type.interfaces; 360 List<InterfaceType> interfaces2 = classC.type.interfaces;
361 EngineTestCase.assertLength(2, interfaces7); 361 EngineTestCase.assertLength(2, interfaces2);
362 if (identical(interfaces7[0], typeA)) { 362 if (identical(interfaces2[0], typeA)) {
363 JUnitTestCase.assertSame(typeB, interfaces7[1]); 363 JUnitTestCase.assertSame(typeB, interfaces2[1]);
364 } else { 364 } else {
365 JUnitTestCase.assertSame(typeB, interfaces7[0]); 365 JUnitTestCase.assertSame(typeB, interfaces2[0]);
366 JUnitTestCase.assertSame(typeA, interfaces7[1]); 366 JUnitTestCase.assertSame(typeA, interfaces2[1]);
367 } 367 }
368 } 368 }
369 void test_getInterfaces_parameterized() { 369 void test_getInterfaces_parameterized() {
370 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); 370 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]);
371 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); 371 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]);
372 InterfaceType typeB = classB.type; 372 InterfaceType typeB = classB.type;
373 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); 373 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA);
374 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; 374 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]];
375 classB.interfaces = <InterfaceType> [typeAF]; 375 classB.interfaces = <InterfaceType> [typeAF];
376 InterfaceType typeI = ElementFactory.classElement2("I", []).type; 376 InterfaceType typeI = ElementFactory.classElement2("I", []).type;
377 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); 377 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB);
378 typeBI.typeArguments = <Type2> [typeI]; 378 typeBI.typeArguments = <Type2> [typeI];
379 List<InterfaceType> interfaces8 = typeBI.interfaces; 379 List<InterfaceType> interfaces2 = typeBI.interfaces;
380 EngineTestCase.assertLength(1, interfaces8); 380 EngineTestCase.assertLength(1, interfaces2);
381 InterfaceType result = interfaces8[0]; 381 InterfaceType result = interfaces2[0];
382 JUnitTestCase.assertSame(classA, result.element); 382 JUnitTestCase.assertSame(classA, result.element);
383 JUnitTestCase.assertSame(typeI, result.typeArguments[0]); 383 JUnitTestCase.assertSame(typeI, result.typeArguments[0]);
384 } 384 }
385 void test_getLeastUpperBound_directInterfaceCase() { 385 void test_getLeastUpperBound_directInterfaceCase() {
386 ClassElementImpl classA = ElementFactory.classElement2("A", []); 386 ClassElementImpl classA = ElementFactory.classElement2("A", []);
387 ClassElementImpl classB = ElementFactory.classElement2("B", []); 387 ClassElementImpl classB = ElementFactory.classElement2("B", []);
388 ClassElementImpl classC = ElementFactory.classElement2("C", []); 388 ClassElementImpl classC = ElementFactory.classElement2("C", []);
389 InterfaceType typeA = classA.type; 389 InterfaceType typeA = classA.type;
390 InterfaceType typeB = classB.type; 390 InterfaceType typeB = classB.type;
391 InterfaceType typeC = classC.type; 391 InterfaceType typeC = classC.type;
(...skipping 10 matching lines...) Expand all
402 InterfaceType typeC = classC.type; 402 InterfaceType typeC = classC.type;
403 JUnitTestCase.assertEquals(typeB, typeB.getLeastUpperBound(typeC)); 403 JUnitTestCase.assertEquals(typeB, typeB.getLeastUpperBound(typeC));
404 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeB)); 404 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeB));
405 } 405 }
406 void test_getLeastUpperBound_functionType() { 406 void test_getLeastUpperBound_functionType() {
407 Type2 interfaceType = ElementFactory.classElement2("A", []).type; 407 Type2 interfaceType = ElementFactory.classElement2("A", []).type;
408 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(new FunctionElemen tImpl.con1(ASTFactory.identifier3("f"))); 408 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(new FunctionElemen tImpl.con1(ASTFactory.identifier3("f")));
409 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(functionType)); 409 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(functionType));
410 } 410 }
411 void test_getLeastUpperBound_ignoreTypeParameters() { 411 void test_getLeastUpperBound_ignoreTypeParameters() {
412 InterfaceType listType6 = _typeProvider.listType; 412 InterfaceType listType2 = _typeProvider.listType;
413 InterfaceType intType11 = _typeProvider.intType; 413 InterfaceType intType2 = _typeProvider.intType;
414 InterfaceType doubleType4 = _typeProvider.doubleType; 414 InterfaceType doubleType2 = _typeProvider.doubleType;
415 InterfaceType listOfIntType = listType6.substitute5(<Type2> [intType11]); 415 InterfaceType listOfIntType = listType2.substitute5(<Type2> [intType2]);
416 InterfaceType listOfDoubleType = listType6.substitute5(<Type2> [doubleType4] ); 416 InterfaceType listOfDoubleType = listType2.substitute5(<Type2> [doubleType2] );
417 JUnitTestCase.assertEquals(listType6, listOfIntType.getLeastUpperBound(listO fDoubleType)); 417 JUnitTestCase.assertEquals(listType2, listOfIntType.getLeastUpperBound(listO fDoubleType));
418 } 418 }
419 void test_getLeastUpperBound_mixinCase() { 419 void test_getLeastUpperBound_mixinCase() {
420 ClassElement classA = ElementFactory.classElement2("A", []); 420 ClassElement classA = ElementFactory.classElement2("A", []);
421 ClassElement classB = ElementFactory.classElement("B", classA.type, []); 421 ClassElement classB = ElementFactory.classElement("B", classA.type, []);
422 ClassElement classC = ElementFactory.classElement("C", classA.type, []); 422 ClassElement classC = ElementFactory.classElement("C", classA.type, []);
423 ClassElementImpl classD = ElementFactory.classElement("D", classB.type, []); 423 ClassElementImpl classD = ElementFactory.classElement("D", classB.type, []);
424 InterfaceType typeA = classA.type; 424 InterfaceType typeA = classA.type;
425 InterfaceType typeC = classC.type; 425 InterfaceType typeC = classC.type;
426 InterfaceType typeD = classD.type; 426 InterfaceType typeD = classD.type;
427 classD.mixins = <InterfaceType> [ElementFactory.classElement2("M", []).type, ElementFactory.classElement2("N", []).type, ElementFactory.classElement2("O", [ ]).type, ElementFactory.classElement2("P", []).type]; 427 classD.mixins = <InterfaceType> [ElementFactory.classElement2("M", []).type, ElementFactory.classElement2("N", []).type, ElementFactory.classElement2("O", [ ]).type, ElementFactory.classElement2("P", []).type];
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 void test_getSuperclass_parameterized() { 654 void test_getSuperclass_parameterized() {
655 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); 655 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]);
656 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); 656 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]);
657 InterfaceType typeB = classB.type; 657 InterfaceType typeB = classB.type;
658 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); 658 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA);
659 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; 659 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]];
660 classB.supertype = typeAF; 660 classB.supertype = typeAF;
661 InterfaceType typeI = ElementFactory.classElement2("I", []).type; 661 InterfaceType typeI = ElementFactory.classElement2("I", []).type;
662 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); 662 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB);
663 typeBI.typeArguments = <Type2> [typeI]; 663 typeBI.typeArguments = <Type2> [typeI];
664 InterfaceType superclass6 = typeBI.superclass; 664 InterfaceType superclass2 = typeBI.superclass;
665 JUnitTestCase.assertSame(classA, superclass6.element); 665 JUnitTestCase.assertSame(classA, superclass2.element);
666 JUnitTestCase.assertSame(typeI, superclass6.typeArguments[0]); 666 JUnitTestCase.assertSame(typeI, superclass2.typeArguments[0]);
667 } 667 }
668 void test_getTypeArguments_empty() { 668 void test_getTypeArguments_empty() {
669 InterfaceType type32 = ElementFactory.classElement2("A", []).type; 669 InterfaceType type2 = ElementFactory.classElement2("A", []).type;
670 EngineTestCase.assertLength(0, type32.typeArguments); 670 EngineTestCase.assertLength(0, type2.typeArguments);
671 } 671 }
672 void test_isDirectSupertypeOf_extends() { 672 void test_isDirectSupertypeOf_extends() {
673 ClassElement classA = ElementFactory.classElement2("A", []); 673 ClassElement classA = ElementFactory.classElement2("A", []);
674 ClassElement classB = ElementFactory.classElement("B", classA.type, []); 674 ClassElement classB = ElementFactory.classElement("B", classA.type, []);
675 InterfaceType typeA = classA.type; 675 InterfaceType typeA = classA.type;
676 InterfaceType typeB = classB.type; 676 InterfaceType typeB = classB.type;
677 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); 677 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB));
678 } 678 }
679 void test_isDirectSupertypeOf_false() { 679 void test_isDirectSupertypeOf_false() {
680 ClassElement classA = ElementFactory.classElement2("A", []); 680 ClassElement classA = ElementFactory.classElement2("A", []);
(...skipping 13 matching lines...) Expand all
694 } 694 }
695 void test_isDirectSupertypeOf_with() { 695 void test_isDirectSupertypeOf_with() {
696 ClassElementImpl classA = ElementFactory.classElement2("A", []); 696 ClassElementImpl classA = ElementFactory.classElement2("A", []);
697 ClassElementImpl classB = ElementFactory.classElement2("B", []); 697 ClassElementImpl classB = ElementFactory.classElement2("B", []);
698 InterfaceType typeA = classA.type; 698 InterfaceType typeA = classA.type;
699 InterfaceType typeB = classB.type; 699 InterfaceType typeB = classB.type;
700 classB.mixins = <InterfaceType> [typeA]; 700 classB.mixins = <InterfaceType> [typeA];
701 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); 701 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB));
702 } 702 }
703 void test_isMoreSpecificThan_bottom() { 703 void test_isMoreSpecificThan_bottom() {
704 Type2 type33 = ElementFactory.classElement2("A", []).type; 704 Type2 type2 = ElementFactory.classElement2("A", []).type;
705 JUnitTestCase.assertTrue(BottomTypeImpl.instance.isMoreSpecificThan(type33)) ; 705 JUnitTestCase.assertTrue(BottomTypeImpl.instance.isMoreSpecificThan(type2));
706 } 706 }
707 void test_isMoreSpecificThan_covariance() { 707 void test_isMoreSpecificThan_covariance() {
708 ClassElement classA = ElementFactory.classElement2("A", ["E"]); 708 ClassElement classA = ElementFactory.classElement2("A", ["E"]);
709 ClassElement classI = ElementFactory.classElement2("I", []); 709 ClassElement classI = ElementFactory.classElement2("I", []);
710 ClassElement classJ = ElementFactory.classElement("J", classI.type, []); 710 ClassElement classJ = ElementFactory.classElement("J", classI.type, []);
711 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); 711 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA);
712 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA); 712 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA);
713 typeAI.typeArguments = <Type2> [classI.type]; 713 typeAI.typeArguments = <Type2> [classI.type];
714 typeAJ.typeArguments = <Type2> [classJ.type]; 714 typeAJ.typeArguments = <Type2> [classJ.type];
715 JUnitTestCase.assertTrue(typeAJ.isMoreSpecificThan(typeAI)); 715 JUnitTestCase.assertTrue(typeAJ.isMoreSpecificThan(typeAI));
716 JUnitTestCase.assertFalse(typeAI.isMoreSpecificThan(typeAJ)); 716 JUnitTestCase.assertFalse(typeAI.isMoreSpecificThan(typeAJ));
717 } 717 }
718 void test_isMoreSpecificThan_directSupertype() { 718 void test_isMoreSpecificThan_directSupertype() {
719 ClassElement classA = ElementFactory.classElement2("A", []); 719 ClassElement classA = ElementFactory.classElement2("A", []);
720 ClassElement classB = ElementFactory.classElement("B", classA.type, []); 720 ClassElement classB = ElementFactory.classElement("B", classA.type, []);
721 InterfaceType typeA = classA.type; 721 InterfaceType typeA = classA.type;
722 InterfaceType typeB = classB.type; 722 InterfaceType typeB = classB.type;
723 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA)); 723 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA));
724 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB)); 724 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB));
725 } 725 }
726 void test_isMoreSpecificThan_dynamic() { 726 void test_isMoreSpecificThan_dynamic() {
727 InterfaceType type34 = ElementFactory.classElement2("A", []).type; 727 InterfaceType type2 = ElementFactory.classElement2("A", []).type;
728 JUnitTestCase.assertTrue(type34.isMoreSpecificThan(DynamicTypeImpl.instance) ); 728 JUnitTestCase.assertTrue(type2.isMoreSpecificThan(DynamicTypeImpl.instance)) ;
729 } 729 }
730 void test_isMoreSpecificThan_indirectSupertype() { 730 void test_isMoreSpecificThan_indirectSupertype() {
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 ClassElement classC = ElementFactory.classElement("C", classB.type, []); 733 ClassElement classC = ElementFactory.classElement("C", classB.type, []);
734 InterfaceType typeA = classA.type; 734 InterfaceType typeA = classA.type;
735 InterfaceType typeC = classC.type; 735 InterfaceType typeC = classC.type;
736 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); 736 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA));
737 } 737 }
738 void test_isMoreSpecificThan_self() { 738 void test_isMoreSpecificThan_self() {
739 InterfaceType type35 = ElementFactory.classElement2("A", []).type; 739 InterfaceType type2 = ElementFactory.classElement2("A", []).type;
740 JUnitTestCase.assertTrue(type35.isMoreSpecificThan(type35)); 740 JUnitTestCase.assertTrue(type2.isMoreSpecificThan(type2));
741 } 741 }
742 void test_isSubtypeOf_directSubtype() { 742 void test_isSubtypeOf_directSubtype() {
743 ClassElement classA = ElementFactory.classElement2("A", []); 743 ClassElement classA = ElementFactory.classElement2("A", []);
744 ClassElement classB = ElementFactory.classElement("B", classA.type, []); 744 ClassElement classB = ElementFactory.classElement("B", classA.type, []);
745 InterfaceType typeA = classA.type; 745 InterfaceType typeA = classA.type;
746 InterfaceType typeB = classB.type; 746 InterfaceType typeB = classB.type;
747 JUnitTestCase.assertTrue(typeB.isSubtypeOf(typeA)); 747 JUnitTestCase.assertTrue(typeB.isSubtypeOf(typeA));
748 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeB)); 748 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeB));
749 } 749 }
750 void test_isSubtypeOf_dynamic() { 750 void test_isSubtypeOf_dynamic() {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 ClassElement classA = ElementFactory.classElement2("A", []); 888 ClassElement classA = ElementFactory.classElement2("A", []);
889 InterfaceType typeA = classA.type; 889 InterfaceType typeA = classA.type;
890 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeA)); 890 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeA));
891 } 891 }
892 void test_lookUpGetter_implemented() { 892 void test_lookUpGetter_implemented() {
893 ClassElementImpl classA = ElementFactory.classElement2("A", []); 893 ClassElementImpl classA = ElementFactory.classElement2("A", []);
894 String getterName = "g"; 894 String getterName = "g";
895 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f alse, null); 895 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f alse, null);
896 classA.accessors = <PropertyAccessorElement> [getterG]; 896 classA.accessors = <PropertyAccessorElement> [getterG];
897 InterfaceType typeA = classA.type; 897 InterfaceType typeA = classA.type;
898 LibraryElementImpl library20 = ElementFactory.library(createAnalysisContext( ), "lib"); 898 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
899 CompilationUnitElement unit = library20.definingCompilationUnit; 899 CompilationUnitElement unit = library2.definingCompilationUnit;
900 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; 900 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA];
901 JUnitTestCase.assertSame(getterG, typeA.lookUpGetter(getterName, library20)) ; 901 JUnitTestCase.assertSame(getterG, typeA.lookUpGetter(getterName, library2));
902 } 902 }
903 void test_lookUpGetter_inherited() { 903 void test_lookUpGetter_inherited() {
904 ClassElementImpl classA = ElementFactory.classElement2("A", []); 904 ClassElementImpl classA = ElementFactory.classElement2("A", []);
905 String getterName = "g"; 905 String getterName = "g";
906 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f alse, null); 906 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f alse, null);
907 classA.accessors = <PropertyAccessorElement> [getterG]; 907 classA.accessors = <PropertyAccessorElement> [getterG];
908 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 908 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
909 InterfaceType typeB = classB.type; 909 InterfaceType typeB = classB.type;
910 LibraryElementImpl library21 = ElementFactory.library(createAnalysisContext( ), "lib"); 910 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
911 CompilationUnitElement unit = library21.definingCompilationUnit; 911 CompilationUnitElement unit = library2.definingCompilationUnit;
912 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class B]; 912 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class B];
913 JUnitTestCase.assertSame(getterG, typeB.lookUpGetter(getterName, library21)) ; 913 JUnitTestCase.assertSame(getterG, typeB.lookUpGetter(getterName, library2));
914 } 914 }
915 void test_lookUpGetter_unimplemented() { 915 void test_lookUpGetter_unimplemented() {
916 ClassElementImpl classA = ElementFactory.classElement2("A", []); 916 ClassElementImpl classA = ElementFactory.classElement2("A", []);
917 InterfaceType typeA = classA.type; 917 InterfaceType typeA = classA.type;
918 LibraryElementImpl library22 = ElementFactory.library(createAnalysisContext( ), "lib"); 918 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
919 CompilationUnitElement unit = library22.definingCompilationUnit; 919 CompilationUnitElement unit = library2.definingCompilationUnit;
920 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; 920 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA];
921 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library22)); 921 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library2));
922 } 922 }
923 void test_lookUpMethod_implemented() { 923 void test_lookUpMethod_implemented() {
924 ClassElementImpl classA = ElementFactory.classElement2("A", []); 924 ClassElementImpl classA = ElementFactory.classElement2("A", []);
925 String methodName = "m"; 925 String methodName = "m";
926 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [ ]); 926 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [ ]);
927 classA.methods = <MethodElement> [methodM]; 927 classA.methods = <MethodElement> [methodM];
928 InterfaceType typeA = classA.type; 928 InterfaceType typeA = classA.type;
929 LibraryElementImpl library23 = ElementFactory.library(createAnalysisContext( ), "lib"); 929 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
930 CompilationUnitElement unit = library23.definingCompilationUnit; 930 CompilationUnitElement unit = library2.definingCompilationUnit;
931 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; 931 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA];
932 JUnitTestCase.assertSame(methodM, typeA.lookUpMethod(methodName, library23)) ; 932 JUnitTestCase.assertSame(methodM, typeA.lookUpMethod(methodName, library2));
933 } 933 }
934 void test_lookUpMethod_inherited() { 934 void test_lookUpMethod_inherited() {
935 ClassElementImpl classA = ElementFactory.classElement2("A", []); 935 ClassElementImpl classA = ElementFactory.classElement2("A", []);
936 String methodName = "m"; 936 String methodName = "m";
937 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [ ]); 937 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [ ]);
938 classA.methods = <MethodElement> [methodM]; 938 classA.methods = <MethodElement> [methodM];
939 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 939 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
940 InterfaceType typeB = classB.type; 940 InterfaceType typeB = classB.type;
941 LibraryElementImpl library24 = ElementFactory.library(createAnalysisContext( ), "lib"); 941 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
942 CompilationUnitElement unit = library24.definingCompilationUnit; 942 CompilationUnitElement unit = library2.definingCompilationUnit;
943 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class B]; 943 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class B];
944 JUnitTestCase.assertSame(methodM, typeB.lookUpMethod(methodName, library24)) ; 944 JUnitTestCase.assertSame(methodM, typeB.lookUpMethod(methodName, library2));
945 } 945 }
946 void test_lookUpMethod_parameterized() { 946 void test_lookUpMethod_parameterized() {
947 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); 947 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]);
948 Type2 typeE = classA.type.typeArguments[0]; 948 Type2 typeE = classA.type.typeArguments[0];
949 String methodName = "m"; 949 String methodName = "m";
950 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE, [typeE]); 950 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE, [typeE]);
951 classA.methods = <MethodElement> [methodM]; 951 classA.methods = <MethodElement> [methodM];
952 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); 952 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]);
953 InterfaceType typeB = classB.type; 953 InterfaceType typeB = classB.type;
954 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); 954 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA);
955 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; 955 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]];
956 classB.supertype = typeAF; 956 classB.supertype = typeAF;
957 LibraryElementImpl library25 = ElementFactory.library(createAnalysisContext( ), "lib"); 957 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
958 CompilationUnitElement unit = library25.definingCompilationUnit; 958 CompilationUnitElement unit = library2.definingCompilationUnit;
959 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; 959 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA];
960 InterfaceType typeI = ElementFactory.classElement2("I", []).type; 960 InterfaceType typeI = ElementFactory.classElement2("I", []).type;
961 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); 961 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB);
962 typeBI.typeArguments = <Type2> [typeI]; 962 typeBI.typeArguments = <Type2> [typeI];
963 MethodElement method = typeBI.lookUpMethod(methodName, library25); 963 MethodElement method = typeBI.lookUpMethod(methodName, library2);
964 JUnitTestCase.assertNotNull(method); 964 JUnitTestCase.assertNotNull(method);
965 FunctionType methodType = method.type; 965 FunctionType methodType = method.type;
966 JUnitTestCase.assertSame(typeI, methodType.returnType); 966 JUnitTestCase.assertSame(typeI, methodType.returnType);
967 List<Type2> parameterTypes = methodType.normalParameterTypes; 967 List<Type2> parameterTypes = methodType.normalParameterTypes;
968 EngineTestCase.assertLength(1, parameterTypes); 968 EngineTestCase.assertLength(1, parameterTypes);
969 JUnitTestCase.assertSame(typeI, parameterTypes[0]); 969 JUnitTestCase.assertSame(typeI, parameterTypes[0]);
970 } 970 }
971 void test_lookUpMethod_unimplemented() { 971 void test_lookUpMethod_unimplemented() {
972 ClassElementImpl classA = ElementFactory.classElement2("A", []); 972 ClassElementImpl classA = ElementFactory.classElement2("A", []);
973 InterfaceType typeA = classA.type; 973 InterfaceType typeA = classA.type;
974 LibraryElementImpl library26 = ElementFactory.library(createAnalysisContext( ), "lib"); 974 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
975 CompilationUnitElement unit = library26.definingCompilationUnit; 975 CompilationUnitElement unit = library2.definingCompilationUnit;
976 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; 976 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA];
977 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library26)); 977 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library2));
978 } 978 }
979 void test_lookUpSetter_implemented() { 979 void test_lookUpSetter_implemented() {
980 ClassElementImpl classA = ElementFactory.classElement2("A", []); 980 ClassElementImpl classA = ElementFactory.classElement2("A", []);
981 String setterName = "s"; 981 String setterName = "s";
982 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f alse, null); 982 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f alse, null);
983 classA.accessors = <PropertyAccessorElement> [setterS]; 983 classA.accessors = <PropertyAccessorElement> [setterS];
984 InterfaceType typeA = classA.type; 984 InterfaceType typeA = classA.type;
985 LibraryElementImpl library27 = ElementFactory.library(createAnalysisContext( ), "lib"); 985 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
986 CompilationUnitElement unit = library27.definingCompilationUnit; 986 CompilationUnitElement unit = library2.definingCompilationUnit;
987 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; 987 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA];
988 JUnitTestCase.assertSame(setterS, typeA.lookUpSetter(setterName, library27)) ; 988 JUnitTestCase.assertSame(setterS, typeA.lookUpSetter(setterName, library2));
989 } 989 }
990 void test_lookUpSetter_inherited() { 990 void test_lookUpSetter_inherited() {
991 ClassElementImpl classA = ElementFactory.classElement2("A", []); 991 ClassElementImpl classA = ElementFactory.classElement2("A", []);
992 String setterName = "g"; 992 String setterName = "g";
993 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f alse, null); 993 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f alse, null);
994 classA.accessors = <PropertyAccessorElement> [setterS]; 994 classA.accessors = <PropertyAccessorElement> [setterS];
995 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 995 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
996 InterfaceType typeB = classB.type; 996 InterfaceType typeB = classB.type;
997 LibraryElementImpl library28 = ElementFactory.library(createAnalysisContext( ), "lib"); 997 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
998 CompilationUnitElement unit = library28.definingCompilationUnit; 998 CompilationUnitElement unit = library2.definingCompilationUnit;
999 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class B]; 999 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class B];
1000 JUnitTestCase.assertSame(setterS, typeB.lookUpSetter(setterName, library28)) ; 1000 JUnitTestCase.assertSame(setterS, typeB.lookUpSetter(setterName, library2));
1001 } 1001 }
1002 void test_lookUpSetter_unimplemented() { 1002 void test_lookUpSetter_unimplemented() {
1003 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1003 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1004 InterfaceType typeA = classA.type; 1004 InterfaceType typeA = classA.type;
1005 LibraryElementImpl library29 = ElementFactory.library(createAnalysisContext( ), "lib"); 1005 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1006 CompilationUnitElement unit = library29.definingCompilationUnit; 1006 CompilationUnitElement unit = library2.definingCompilationUnit;
1007 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; 1007 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA];
1008 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library29)); 1008 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library2));
1009 } 1009 }
1010 void test_setTypeArguments() { 1010 void test_setTypeArguments() {
1011 InterfaceTypeImpl type36 = ElementFactory.classElement2("A", []).type as Int erfaceTypeImpl; 1011 InterfaceTypeImpl type2 = ElementFactory.classElement2("A", []).type as Inte rfaceTypeImpl;
1012 List<Type2> typeArguments = <Type2> [ElementFactory.classElement2("B", []).t ype, ElementFactory.classElement2("C", []).type]; 1012 List<Type2> typeArguments = <Type2> [ElementFactory.classElement2("B", []).t ype, ElementFactory.classElement2("C", []).type];
1013 type36.typeArguments = typeArguments; 1013 type2.typeArguments = typeArguments;
1014 JUnitTestCase.assertEquals(typeArguments, type36.typeArguments); 1014 JUnitTestCase.assertEquals(typeArguments, type2.typeArguments);
1015 } 1015 }
1016 void test_substitute_equal() { 1016 void test_substitute_equal() {
1017 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1017 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1018 TypeVariableElementImpl parameterElement = new TypeVariableElementImpl(ASTFa ctory.identifier3("E")); 1018 TypeVariableElementImpl parameterElement = new TypeVariableElementImpl(ASTFa ctory.identifier3("E"));
1019 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); 1019 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA);
1020 TypeVariableTypeImpl parameter = new TypeVariableTypeImpl(parameterElement); 1020 TypeVariableTypeImpl parameter = new TypeVariableTypeImpl(parameterElement);
1021 type.typeArguments = <Type2> [parameter]; 1021 type.typeArguments = <Type2> [parameter];
1022 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; 1022 InterfaceType argumentType = ElementFactory.classElement2("B", []).type;
1023 InterfaceType result = type.substitute2(<Type2> [argumentType], <Type2> [par ameter]); 1023 InterfaceType result = type.substitute2(<Type2> [argumentType], <Type2> [par ameter]);
1024 JUnitTestCase.assertEquals(classA, result.element); 1024 JUnitTestCase.assertEquals(classA, result.element);
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 typeArguments[i] = new TypeVariableTypeImpl(variable); 1437 typeArguments[i] = new TypeVariableTypeImpl(variable);
1438 variable.type = typeArguments[i]; 1438 variable.type = typeArguments[i];
1439 } 1439 }
1440 element.typeVariables = typeVariables; 1440 element.typeVariables = typeVariables;
1441 type.typeArguments = typeArguments; 1441 type.typeArguments = typeArguments;
1442 } 1442 }
1443 return element; 1443 return element;
1444 } 1444 }
1445 static ClassElementImpl classElement2(String typeName, List<String> parameterN ames) => classElement(typeName, object.type, parameterNames); 1445 static ClassElementImpl classElement2(String typeName, List<String> parameterN ames) => classElement(typeName, object.type, parameterNames);
1446 static ConstructorElementImpl constructorElement(String name) => new Construct orElementImpl(name == null ? null : ASTFactory.identifier3(name)); 1446 static ConstructorElementImpl constructorElement(String name) => new Construct orElementImpl(name == null ? null : ASTFactory.identifier3(name));
1447 static ExportElementImpl exportFor(LibraryElement exportedLibrary4, List<Names paceCombinator> combinators4) { 1447 static ExportElementImpl exportFor(LibraryElement exportedLibrary2, List<Names paceCombinator> combinators2) {
1448 ExportElementImpl spec = new ExportElementImpl(); 1448 ExportElementImpl spec = new ExportElementImpl();
1449 spec.exportedLibrary = exportedLibrary4; 1449 spec.exportedLibrary = exportedLibrary2;
1450 spec.combinators = combinators4; 1450 spec.combinators = combinators2;
1451 return spec; 1451 return spec;
1452 } 1452 }
1453 static FieldElementImpl fieldElement(String name, bool isStatic, bool isFinal, bool isConst, Type2 type43) { 1453 static FieldElementImpl fieldElement(String name, bool isStatic, bool isFinal, bool isConst, Type2 type2) {
1454 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na me)); 1454 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na me));
1455 field.const3 = isConst; 1455 field.const3 = isConst;
1456 field.final2 = isFinal; 1456 field.final2 = isFinal;
1457 field.static = isStatic; 1457 field.static = isStatic;
1458 field.type = type43; 1458 field.type = type2;
1459 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi eld); 1459 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi eld);
1460 getter.getter = true; 1460 getter.getter = true;
1461 getter.synthetic = true; 1461 getter.synthetic = true;
1462 field.getter = getter; 1462 field.getter = getter;
1463 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); 1463 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter);
1464 getterType.returnType = type43; 1464 getterType.returnType = type2;
1465 getter.type = getterType; 1465 getter.type = getterType;
1466 if (!isConst && !isFinal) { 1466 if (!isConst && !isFinal) {
1467 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2( field); 1467 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2( field);
1468 setter.setter = true; 1468 setter.setter = true;
1469 setter.synthetic = true; 1469 setter.synthetic = true;
1470 field.setter = setter; 1470 field.setter = setter;
1471 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(getter); 1471 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(getter);
1472 setterType.normalParameterTypes = <Type2> [type43]; 1472 setterType.normalParameterTypes = <Type2> [type2];
1473 setterType.returnType = VoidTypeImpl.instance; 1473 setterType.returnType = VoidTypeImpl.instance;
1474 setter.type = setterType; 1474 setter.type = setterType;
1475 } 1475 }
1476 return field; 1476 return field;
1477 } 1477 }
1478 static FunctionElementImpl functionElement(String functionName) => functionEle ment4(functionName, null, null, null, null); 1478 static FunctionElementImpl functionElement(String functionName) => functionEle ment4(functionName, null, null, null, null);
1479 static FunctionElementImpl functionElement2(String functionName, ClassElement returnElement) => functionElement3(functionName, returnElement, null, null); 1479 static FunctionElementImpl functionElement2(String functionName, ClassElement returnElement) => functionElement3(functionName, returnElement, null, null);
1480 static FunctionElementImpl functionElement3(String functionName, ClassElement returnElement, List<ClassElement> normalParameters, List<ClassElement> optionalP arameters) { 1480 static FunctionElementImpl functionElement3(String functionName, ClassElement returnElement, List<ClassElement> normalParameters, List<ClassElement> optionalP arameters) {
1481 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor y.identifier3(functionName)); 1481 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor y.identifier3(functionName));
1482 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); 1482 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 } 1530 }
1531 static FunctionElementImpl functionElement5(String functionName, List<ClassEle ment> normalParameters) => functionElement3(functionName, null, normalParameters , null); 1531 static FunctionElementImpl functionElement5(String functionName, List<ClassEle ment> normalParameters) => functionElement3(functionName, null, normalParameters , null);
1532 static FunctionElementImpl functionElement6(String functionName, List<ClassEle ment> normalParameters, List<ClassElement> optionalParameters) => functionElemen t3(functionName, null, normalParameters, optionalParameters); 1532 static FunctionElementImpl functionElement6(String functionName, List<ClassEle ment> normalParameters, List<ClassElement> optionalParameters) => functionElemen t3(functionName, null, normalParameters, optionalParameters);
1533 static FunctionElementImpl functionElement7(String functionName, List<ClassEle ment> normalParameters, List<String> names, List<ClassElement> namedParameters) => functionElement4(functionName, null, normalParameters, names, namedParameters ); 1533 static FunctionElementImpl functionElement7(String functionName, List<ClassEle ment> normalParameters, List<String> names, List<ClassElement> namedParameters) => functionElement4(functionName, null, normalParameters, names, namedParameters );
1534 static ClassElementImpl get object { 1534 static ClassElementImpl get object {
1535 if (_objectElement == null) { 1535 if (_objectElement == null) {
1536 _objectElement = classElement("Object", (null as InterfaceType), []); 1536 _objectElement = classElement("Object", (null as InterfaceType), []);
1537 } 1537 }
1538 return _objectElement; 1538 return _objectElement;
1539 } 1539 }
1540 static PropertyAccessorElementImpl getterElement(String name, bool isStatic, T ype2 type44) { 1540 static PropertyAccessorElementImpl getterElement(String name, bool isStatic, T ype2 type2) {
1541 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na me)); 1541 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na me));
1542 field.static = isStatic; 1542 field.static = isStatic;
1543 field.synthetic = true; 1543 field.synthetic = true;
1544 field.type = type44; 1544 field.type = type2;
1545 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi eld); 1545 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi eld);
1546 getter.getter = true; 1546 getter.getter = true;
1547 field.getter = getter; 1547 field.getter = getter;
1548 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); 1548 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter);
1549 getterType.returnType = type44; 1549 getterType.returnType = type2;
1550 getter.type = getterType; 1550 getter.type = getterType;
1551 return getter; 1551 return getter;
1552 } 1552 }
1553 static ImportElementImpl importFor(LibraryElement importedLibrary5, PrefixElem ent prefix13, List<NamespaceCombinator> combinators5) { 1553 static ImportElementImpl importFor(LibraryElement importedLibrary2, PrefixElem ent prefix2, List<NamespaceCombinator> combinators2) {
1554 ImportElementImpl spec = new ImportElementImpl(); 1554 ImportElementImpl spec = new ImportElementImpl();
1555 spec.importedLibrary = importedLibrary5; 1555 spec.importedLibrary = importedLibrary2;
1556 spec.prefix = prefix13; 1556 spec.prefix = prefix2;
1557 spec.combinators = combinators5; 1557 spec.combinators = combinators2;
1558 return spec; 1558 return spec;
1559 } 1559 }
1560 static LibraryElementImpl library(AnalysisContext context, String libraryName) { 1560 static LibraryElementImpl library(AnalysisContext context, String libraryName) {
1561 String fileName = "${libraryName}.dart"; 1561 String fileName = "${libraryName}.dart";
1562 FileBasedSource source = new FileBasedSource.con1(context.sourceFactory.cont entCache, FileUtilities2.createFile(fileName)); 1562 FileBasedSource source = new FileBasedSource.con1(context.sourceFactory.cont entCache, FileUtilities2.createFile(fileName));
1563 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName); 1563 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName);
1564 unit.source = source; 1564 unit.source = source;
1565 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr aryIdentifier2([libraryName])); 1565 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr aryIdentifier2([libraryName]));
1566 library.definingCompilationUnit = unit; 1566 library.definingCompilationUnit = unit;
1567 return library; 1567 return library;
1568 } 1568 }
1569 static LocalVariableElementImpl localVariableElement(Identifier name) => new L ocalVariableElementImpl(name); 1569 static LocalVariableElementImpl localVariableElement(Identifier name) => new L ocalVariableElementImpl(name);
1570 static LocalVariableElementImpl localVariableElement2(String name) => new Loca lVariableElementImpl(ASTFactory.identifier3(name)); 1570 static LocalVariableElementImpl localVariableElement2(String name) => new Loca lVariableElementImpl(ASTFactory.identifier3(name));
1571 static MethodElementImpl methodElement(String methodName, Type2 returnType16, List<Type2> argumentTypes) { 1571 static MethodElementImpl methodElement(String methodName, Type2 returnType2, L ist<Type2> argumentTypes) {
1572 MethodElementImpl method = new MethodElementImpl.con1(ASTFactory.identifier3 (methodName)); 1572 MethodElementImpl method = new MethodElementImpl.con1(ASTFactory.identifier3 (methodName));
1573 int count = argumentTypes.length; 1573 int count = argumentTypes.length;
1574 List<ParameterElement> parameters = new List<ParameterElement>(count); 1574 List<ParameterElement> parameters = new List<ParameterElement>(count);
1575 for (int i = 0; i < count; i++) { 1575 for (int i = 0; i < count; i++) {
1576 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.ident ifier3("a${i}")); 1576 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.ident ifier3("a${i}"));
1577 parameter.type = argumentTypes[i]; 1577 parameter.type = argumentTypes[i];
1578 parameter.parameterKind = ParameterKind.REQUIRED; 1578 parameter.parameterKind = ParameterKind.REQUIRED;
1579 parameters[i] = parameter; 1579 parameters[i] = parameter;
1580 } 1580 }
1581 method.parameters = parameters; 1581 method.parameters = parameters;
1582 FunctionTypeImpl methodType = new FunctionTypeImpl.con1(method); 1582 FunctionTypeImpl methodType = new FunctionTypeImpl.con1(method);
1583 methodType.normalParameterTypes = argumentTypes; 1583 methodType.normalParameterTypes = argumentTypes;
1584 methodType.returnType = returnType16; 1584 methodType.returnType = returnType2;
1585 method.type = methodType; 1585 method.type = methodType;
1586 return method; 1586 return method;
1587 } 1587 }
1588 static ParameterElementImpl namedParameter(String name) { 1588 static ParameterElementImpl namedParameter(String name) {
1589 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.identif ier3(name)); 1589 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.identif ier3(name));
1590 parameter.parameterKind = ParameterKind.NAMED; 1590 parameter.parameterKind = ParameterKind.NAMED;
1591 return parameter; 1591 return parameter;
1592 } 1592 }
1593 static ParameterElementImpl positionalParameter(String name) { 1593 static ParameterElementImpl positionalParameter(String name) {
1594 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.identif ier3(name)); 1594 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.identif ier3(name));
1595 parameter.parameterKind = ParameterKind.POSITIONAL; 1595 parameter.parameterKind = ParameterKind.POSITIONAL;
1596 return parameter; 1596 return parameter;
1597 } 1597 }
1598 static PrefixElementImpl prefix(String name) => new PrefixElementImpl(ASTFacto ry.identifier3(name)); 1598 static PrefixElementImpl prefix(String name) => new PrefixElementImpl(ASTFacto ry.identifier3(name));
1599 static ParameterElementImpl requiredParameter(String name) { 1599 static ParameterElementImpl requiredParameter(String name) {
1600 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.identif ier3(name)); 1600 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.identif ier3(name));
1601 parameter.parameterKind = ParameterKind.REQUIRED; 1601 parameter.parameterKind = ParameterKind.REQUIRED;
1602 return parameter; 1602 return parameter;
1603 } 1603 }
1604 static PropertyAccessorElementImpl setterElement(String name, bool isStatic, T ype2 type45) { 1604 static PropertyAccessorElementImpl setterElement(String name, bool isStatic, T ype2 type2) {
1605 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na me)); 1605 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na me));
1606 field.static = isStatic; 1606 field.static = isStatic;
1607 field.synthetic = true; 1607 field.synthetic = true;
1608 field.type = type45; 1608 field.type = type2;
1609 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi eld); 1609 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi eld);
1610 getter.getter = true; 1610 getter.getter = true;
1611 field.getter = getter; 1611 field.getter = getter;
1612 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); 1612 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter);
1613 getterType.returnType = type45; 1613 getterType.returnType = type2;
1614 getter.type = getterType; 1614 getter.type = getterType;
1615 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(fi eld); 1615 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(fi eld);
1616 setter.setter = true; 1616 setter.setter = true;
1617 setter.synthetic = true; 1617 setter.synthetic = true;
1618 field.setter = setter; 1618 field.setter = setter;
1619 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(getter); 1619 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(getter);
1620 setterType.normalParameterTypes = <Type2> [type45]; 1620 setterType.normalParameterTypes = <Type2> [type2];
1621 setterType.returnType = VoidTypeImpl.instance; 1621 setterType.returnType = VoidTypeImpl.instance;
1622 setter.type = setterType; 1622 setter.type = setterType;
1623 return setter; 1623 return setter;
1624 } 1624 }
1625 static TopLevelVariableElementImpl topLevelVariableElement(Identifier name) => new TopLevelVariableElementImpl.con1(name); 1625 static TopLevelVariableElementImpl topLevelVariableElement(Identifier name) => new TopLevelVariableElementImpl.con1(name);
1626 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => ne w TopLevelVariableElementImpl.con2(name); 1626 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => ne w TopLevelVariableElementImpl.con2(name);
1627 /** 1627 /**
1628 * Prevent the creation of instances of this class. 1628 * Prevent the creation of instances of this class.
1629 */ 1629 */
1630 ElementFactory() { 1630 ElementFactory() {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 JUnitTestCase.assertSame(method, classA.getMethod(methodName)); 1673 JUnitTestCase.assertSame(method, classA.getMethod(methodName));
1674 } 1674 }
1675 void test_getMethod_undeclared() { 1675 void test_getMethod_undeclared() {
1676 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1676 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1677 String methodName = "m"; 1677 String methodName = "m";
1678 MethodElement method = ElementFactory.methodElement(methodName, null, []); 1678 MethodElement method = ElementFactory.methodElement(methodName, null, []);
1679 classA.methods = <MethodElement> [method]; 1679 classA.methods = <MethodElement> [method];
1680 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); 1680 JUnitTestCase.assertNull(classA.getMethod("${methodName}x"));
1681 } 1681 }
1682 void test_lookUpGetter_declared() { 1682 void test_lookUpGetter_declared() {
1683 LibraryElementImpl library6 = ElementFactory.library(createAnalysisContext() , "lib"); 1683 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1684 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1684 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1685 String getterName = "g"; 1685 String getterName = "g";
1686 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null); 1686 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null);
1687 classA.accessors = <PropertyAccessorElement> [getter]; 1687 classA.accessors = <PropertyAccessorElement> [getter];
1688 ((library6.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA]; 1688 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1689 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library6)); 1689 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library2));
1690 } 1690 }
1691 void test_lookUpGetter_inherited() { 1691 void test_lookUpGetter_inherited() {
1692 LibraryElementImpl library7 = ElementFactory.library(createAnalysisContext() , "lib"); 1692 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1693 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1693 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1694 String getterName = "g"; 1694 String getterName = "g";
1695 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null); 1695 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null);
1696 classA.accessors = <PropertyAccessorElement> [getter]; 1696 classA.accessors = <PropertyAccessorElement> [getter];
1697 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 1697 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
1698 ((library7.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA, classB]; 1698 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA, classB];
1699 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library7)); 1699 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library2));
1700 } 1700 }
1701 void test_lookUpGetter_undeclared() { 1701 void test_lookUpGetter_undeclared() {
1702 LibraryElementImpl library8 = ElementFactory.library(createAnalysisContext() , "lib"); 1702 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1703 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1703 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1704 ((library8.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA]; 1704 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1705 JUnitTestCase.assertNull(classA.lookUpGetter("g", library8)); 1705 JUnitTestCase.assertNull(classA.lookUpGetter("g", library2));
1706 } 1706 }
1707 void test_lookUpMethod_declared() { 1707 void test_lookUpMethod_declared() {
1708 LibraryElementImpl library9 = ElementFactory.library(createAnalysisContext() , "lib"); 1708 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1709 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1709 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1710 String methodName = "m"; 1710 String methodName = "m";
1711 MethodElement method = ElementFactory.methodElement(methodName, null, []); 1711 MethodElement method = ElementFactory.methodElement(methodName, null, []);
1712 classA.methods = <MethodElement> [method]; 1712 classA.methods = <MethodElement> [method];
1713 ((library9.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA]; 1713 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1714 JUnitTestCase.assertSame(method, classA.lookUpMethod(methodName, library9)); 1714 JUnitTestCase.assertSame(method, classA.lookUpMethod(methodName, library2));
1715 } 1715 }
1716 void test_lookUpMethod_inherited() { 1716 void test_lookUpMethod_inherited() {
1717 LibraryElementImpl library10 = ElementFactory.library(createAnalysisContext( ), "lib"); 1717 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1718 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1718 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1719 String methodName = "m"; 1719 String methodName = "m";
1720 MethodElement method = ElementFactory.methodElement(methodName, null, []); 1720 MethodElement method = ElementFactory.methodElement(methodName, null, []);
1721 classA.methods = <MethodElement> [method]; 1721 classA.methods = <MethodElement> [method];
1722 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 1722 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
1723 ((library10.definingCompilationUnit as CompilationUnitElementImpl)).types = <ClassElement> [classA, classB]; 1723 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA, classB];
1724 JUnitTestCase.assertSame(method, classB.lookUpMethod(methodName, library10)) ; 1724 JUnitTestCase.assertSame(method, classB.lookUpMethod(methodName, library2));
1725 } 1725 }
1726 void test_lookUpMethod_undeclared() { 1726 void test_lookUpMethod_undeclared() {
1727 LibraryElementImpl library11 = ElementFactory.library(createAnalysisContext( ), "lib"); 1727 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1728 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1728 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1729 ((library11.definingCompilationUnit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; 1729 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1730 JUnitTestCase.assertNull(classA.lookUpMethod("m", library11)); 1730 JUnitTestCase.assertNull(classA.lookUpMethod("m", library2));
1731 } 1731 }
1732 void test_lookUpSetter_declared() { 1732 void test_lookUpSetter_declared() {
1733 LibraryElementImpl library12 = ElementFactory.library(createAnalysisContext( ), "lib"); 1733 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1734 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1734 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1735 String setterName = "s"; 1735 String setterName = "s";
1736 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null); 1736 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null);
1737 classA.accessors = <PropertyAccessorElement> [setter]; 1737 classA.accessors = <PropertyAccessorElement> [setter];
1738 ((library12.definingCompilationUnit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; 1738 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1739 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library12)) ; 1739 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library2));
1740 } 1740 }
1741 void test_lookUpSetter_inherited() { 1741 void test_lookUpSetter_inherited() {
1742 LibraryElementImpl library13 = ElementFactory.library(createAnalysisContext( ), "lib"); 1742 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1743 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1743 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1744 String setterName = "s"; 1744 String setterName = "s";
1745 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null); 1745 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null);
1746 classA.accessors = <PropertyAccessorElement> [setter]; 1746 classA.accessors = <PropertyAccessorElement> [setter];
1747 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 1747 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
1748 ((library13.definingCompilationUnit as CompilationUnitElementImpl)).types = <ClassElement> [classA, classB]; 1748 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA, classB];
1749 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library13)) ; 1749 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library2));
1750 } 1750 }
1751 void test_lookUpSetter_undeclared() { 1751 void test_lookUpSetter_undeclared() {
1752 LibraryElementImpl library14 = ElementFactory.library(createAnalysisContext( ), "lib"); 1752 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1753 ClassElementImpl classA = ElementFactory.classElement2("A", []); 1753 ClassElementImpl classA = ElementFactory.classElement2("A", []);
1754 ((library14.definingCompilationUnit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; 1754 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classA];
1755 JUnitTestCase.assertNull(classA.lookUpSetter("s", library14)); 1755 JUnitTestCase.assertNull(classA.lookUpSetter("s", library2));
1756 } 1756 }
1757 static dartSuite() { 1757 static dartSuite() {
1758 _ut.group('ClassElementImplTest', () { 1758 _ut.group('ClassElementImplTest', () {
1759 _ut.test('test_getAllSupertypes_interface', () { 1759 _ut.test('test_getAllSupertypes_interface', () {
1760 final __test = new ClassElementImplTest(); 1760 final __test = new ClassElementImplTest();
1761 runJUnitTest(__test, __test.test_getAllSupertypes_interface); 1761 runJUnitTest(__test, __test.test_getAllSupertypes_interface);
1762 }); 1762 });
1763 _ut.test('test_getAllSupertypes_mixins', () { 1763 _ut.test('test_getAllSupertypes_mixins', () {
1764 final __test = new ClassElementImplTest(); 1764 final __test = new ClassElementImplTest();
1765 runJUnitTest(__test, __test.test_getAllSupertypes_mixins); 1765 runJUnitTest(__test, __test.test_getAllSupertypes_mixins);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 }); 1806 });
1807 _ut.test('test_lookUpSetter_undeclared', () { 1807 _ut.test('test_lookUpSetter_undeclared', () {
1808 final __test = new ClassElementImplTest(); 1808 final __test = new ClassElementImplTest();
1809 runJUnitTest(__test, __test.test_lookUpSetter_undeclared); 1809 runJUnitTest(__test, __test.test_lookUpSetter_undeclared);
1810 }); 1810 });
1811 }); 1811 });
1812 } 1812 }
1813 } 1813 }
1814 class ElementImplTest extends EngineTestCase { 1814 class ElementImplTest extends EngineTestCase {
1815 void test_equals() { 1815 void test_equals() {
1816 LibraryElementImpl library15 = ElementFactory.library(createAnalysisContext( ), "lib"); 1816 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1817 ClassElementImpl classElement = ElementFactory.classElement2("C", []); 1817 ClassElementImpl classElement = ElementFactory.classElement2("C", []);
1818 ((library15.definingCompilationUnit as CompilationUnitElementImpl)).types = <ClassElement> [classElement]; 1818 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classElement];
1819 FieldElement field = ElementFactory.fieldElement("next", false, false, false , classElement.type); 1819 FieldElement field = ElementFactory.fieldElement("next", false, false, false , classElement.type);
1820 classElement.fields = <FieldElement> [field]; 1820 classElement.fields = <FieldElement> [field];
1821 JUnitTestCase.assertTrue(field == field); 1821 JUnitTestCase.assertTrue(field == field);
1822 JUnitTestCase.assertFalse(field == field.getter); 1822 JUnitTestCase.assertFalse(field == field.getter);
1823 JUnitTestCase.assertFalse(field == field.setter); 1823 JUnitTestCase.assertFalse(field == field.setter);
1824 JUnitTestCase.assertFalse(field.getter == field.setter); 1824 JUnitTestCase.assertFalse(field.getter == field.setter);
1825 } 1825 }
1826 void test_isAccessibleIn_private_differentLibrary() { 1826 void test_isAccessibleIn_private_differentLibrary() {
1827 AnalysisContextImpl context = createAnalysisContext(); 1827 AnalysisContextImpl context = createAnalysisContext();
1828 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); 1828 LibraryElementImpl library1 = ElementFactory.library(context, "lib1");
1829 ClassElement classElement = ElementFactory.classElement2("_C", []); 1829 ClassElement classElement = ElementFactory.classElement2("_C", []);
1830 ((library1.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classElement]; 1830 ((library1.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classElement];
1831 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); 1831 LibraryElementImpl library2 = ElementFactory.library(context, "lib2");
1832 JUnitTestCase.assertFalse(classElement.isAccessibleIn(library2)); 1832 JUnitTestCase.assertFalse(classElement.isAccessibleIn(library2));
1833 } 1833 }
1834 void test_isAccessibleIn_private_sameLibrary() { 1834 void test_isAccessibleIn_private_sameLibrary() {
1835 LibraryElementImpl library16 = ElementFactory.library(createAnalysisContext( ), "lib"); 1835 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1836 ClassElement classElement = ElementFactory.classElement2("_C", []); 1836 ClassElement classElement = ElementFactory.classElement2("_C", []);
1837 ((library16.definingCompilationUnit as CompilationUnitElementImpl)).types = <ClassElement> [classElement]; 1837 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classElement];
1838 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library16)); 1838 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2));
1839 } 1839 }
1840 void test_isAccessibleIn_public_differentLibrary() { 1840 void test_isAccessibleIn_public_differentLibrary() {
1841 AnalysisContextImpl context = createAnalysisContext(); 1841 AnalysisContextImpl context = createAnalysisContext();
1842 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); 1842 LibraryElementImpl library1 = ElementFactory.library(context, "lib1");
1843 ClassElement classElement = ElementFactory.classElement2("C", []); 1843 ClassElement classElement = ElementFactory.classElement2("C", []);
1844 ((library1.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classElement]; 1844 ((library1.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classElement];
1845 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); 1845 LibraryElementImpl library2 = ElementFactory.library(context, "lib2");
1846 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2)); 1846 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2));
1847 } 1847 }
1848 void test_isAccessibleIn_public_sameLibrary() { 1848 void test_isAccessibleIn_public_sameLibrary() {
1849 LibraryElementImpl library17 = ElementFactory.library(createAnalysisContext( ), "lib"); 1849 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext() , "lib");
1850 ClassElement classElement = ElementFactory.classElement2("C", []); 1850 ClassElement classElement = ElementFactory.classElement2("C", []);
1851 ((library17.definingCompilationUnit as CompilationUnitElementImpl)).types = <ClassElement> [classElement]; 1851 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = < ClassElement> [classElement];
1852 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library17)); 1852 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2));
1853 } 1853 }
1854 static dartSuite() { 1854 static dartSuite() {
1855 _ut.group('ElementImplTest', () { 1855 _ut.group('ElementImplTest', () {
1856 _ut.test('test_equals', () { 1856 _ut.test('test_equals', () {
1857 final __test = new ElementImplTest(); 1857 final __test = new ElementImplTest();
1858 runJUnitTest(__test, __test.test_equals); 1858 runJUnitTest(__test, __test.test_equals);
1859 }); 1859 });
1860 _ut.test('test_isAccessibleIn_private_differentLibrary', () { 1860 _ut.test('test_isAccessibleIn_private_differentLibrary', () {
1861 final __test = new ElementImplTest(); 1861 final __test = new ElementImplTest();
1862 runJUnitTest(__test, __test.test_isAccessibleIn_private_differentLibrary ); 1862 runJUnitTest(__test, __test.test_isAccessibleIn_private_differentLibrary );
(...skipping 27 matching lines...) Expand all
1890 Map<String, Type2> types = type.namedParameterTypes; 1890 Map<String, Type2> types = type.namedParameterTypes;
1891 EngineTestCase.assertSize2(0, types); 1891 EngineTestCase.assertSize2(0, types);
1892 } 1892 }
1893 void test_getNormalParameterTypes() { 1893 void test_getNormalParameterTypes() {
1894 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f"))); 1894 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f")));
1895 List<Type2> types = type.normalParameterTypes; 1895 List<Type2> types = type.normalParameterTypes;
1896 EngineTestCase.assertLength(0, types); 1896 EngineTestCase.assertLength(0, types);
1897 } 1897 }
1898 void test_getReturnType() { 1898 void test_getReturnType() {
1899 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f"))); 1899 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f")));
1900 Type2 returnType12 = type.returnType; 1900 Type2 returnType2 = type.returnType;
1901 JUnitTestCase.assertEquals(VoidTypeImpl.instance, returnType12); 1901 JUnitTestCase.assertEquals(VoidTypeImpl.instance, returnType2);
1902 } 1902 }
1903 void test_getTypeArguments() { 1903 void test_getTypeArguments() {
1904 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f"))); 1904 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f")));
1905 List<Type2> types = type.typeArguments; 1905 List<Type2> types = type.typeArguments;
1906 EngineTestCase.assertLength(0, types); 1906 EngineTestCase.assertLength(0, types);
1907 } 1907 }
1908 void test_hashCode_element() { 1908 void test_hashCode_element() {
1909 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f"))); 1909 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f")));
1910 type.hashCode; 1910 type.hashCode;
1911 } 1911 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f"))); 2094 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f")));
2095 List<Type2> expectedTypes = <Type2> [new InterfaceTypeImpl.con1(new ClassEle mentImpl(ASTFactory.identifier3("C")))]; 2095 List<Type2> expectedTypes = <Type2> [new InterfaceTypeImpl.con1(new ClassEle mentImpl(ASTFactory.identifier3("C")))];
2096 type.normalParameterTypes = expectedTypes; 2096 type.normalParameterTypes = expectedTypes;
2097 List<Type2> types = type.normalParameterTypes; 2097 List<Type2> types = type.normalParameterTypes;
2098 JUnitTestCase.assertEquals(expectedTypes, types); 2098 JUnitTestCase.assertEquals(expectedTypes, types);
2099 } 2099 }
2100 void test_setReturnType() { 2100 void test_setReturnType() {
2101 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f"))); 2101 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f")));
2102 Type2 expectedType = new InterfaceTypeImpl.con1(new ClassElementImpl(ASTFact ory.identifier3("C"))); 2102 Type2 expectedType = new InterfaceTypeImpl.con1(new ClassElementImpl(ASTFact ory.identifier3("C")));
2103 type.returnType = expectedType; 2103 type.returnType = expectedType;
2104 Type2 returnType13 = type.returnType; 2104 Type2 returnType2 = type.returnType;
2105 JUnitTestCase.assertEquals(expectedType, returnType13); 2105 JUnitTestCase.assertEquals(expectedType, returnType2);
2106 } 2106 }
2107 void test_setTypeArguments() { 2107 void test_setTypeArguments() {
2108 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f"))); 2108 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co n1(ASTFactory.identifier3("f")));
2109 Type2 expectedType = new TypeVariableTypeImpl(new TypeVariableElementImpl(AS TFactory.identifier3("C"))); 2109 Type2 expectedType = new TypeVariableTypeImpl(new TypeVariableElementImpl(AS TFactory.identifier3("C")));
2110 type.typeArguments = <Type2> [expectedType]; 2110 type.typeArguments = <Type2> [expectedType];
2111 List<Type2> arguments = type.typeArguments; 2111 List<Type2> arguments = type.typeArguments;
2112 EngineTestCase.assertLength(1, arguments); 2112 EngineTestCase.assertLength(1, arguments);
2113 JUnitTestCase.assertEquals(expectedType, arguments[0]); 2113 JUnitTestCase.assertEquals(expectedType, arguments[0]);
2114 } 2114 }
2115 void test_substitute2_equal() { 2115 void test_substitute2_equal() {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 } 2333 }
2334 main() { 2334 main() {
2335 FunctionTypeImplTest.dartSuite(); 2335 FunctionTypeImplTest.dartSuite();
2336 InterfaceTypeImplTest.dartSuite(); 2336 InterfaceTypeImplTest.dartSuite();
2337 TypeVariableTypeImplTest.dartSuite(); 2337 TypeVariableTypeImplTest.dartSuite();
2338 ClassElementImplTest.dartSuite(); 2338 ClassElementImplTest.dartSuite();
2339 ElementLocationImplTest.dartSuite(); 2339 ElementLocationImplTest.dartSuite();
2340 ElementImplTest.dartSuite(); 2340 ElementImplTest.dartSuite();
2341 LibraryElementImplTest.dartSuite(); 2341 LibraryElementImplTest.dartSuite();
2342 } 2342 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698