| 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 |
| 3 library engine.element_test; | 4 library engine.element_test; |
| 5 |
| 4 import 'package:analyzer/src/generated/java_core.dart'; | 6 import 'package:analyzer/src/generated/java_core.dart'; |
| 5 import 'package:analyzer/src/generated/java_engine_io.dart'; | 7 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 6 import 'package:analyzer/src/generated/java_junit.dart'; | 8 import 'package:analyzer/src/generated/java_junit.dart'; |
| 7 import 'package:analyzer/src/generated/source_io.dart'; | 9 import 'package:analyzer/src/generated/source_io.dart'; |
| 8 import 'package:analyzer/src/generated/utilities_dart.dart'; | 10 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 11 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 12 import 'package:analyzer/src/generated/element.dart'; |
| 11 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext, Analys
isContextImpl; | 13 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext, Analys
isContextImpl; |
| 12 import 'package:unittest/unittest.dart' as _ut; | 14 import 'package:unittest/unittest.dart' as _ut; |
| 13 import 'test_support.dart'; | 15 import 'test_support.dart'; |
| 14 import 'ast_test.dart' show ASTFactory; | 16 import 'ast_test.dart' show ASTFactory; |
| 15 import 'resolver_test.dart' show TestTypeProvider; | 17 import 'resolver_test.dart' show TestTypeProvider; |
| 18 |
| 16 class ElementLocationImplTest extends EngineTestCase { | 19 class ElementLocationImplTest extends EngineTestCase { |
| 17 void test_create_encoding() { | 20 void test_create_encoding() { |
| 18 String encoding = "a;b;c"; | 21 String encoding = "a;b;c"; |
| 19 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); | 22 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); |
| 20 JUnitTestCase.assertEquals(encoding, location.encoding); | 23 JUnitTestCase.assertEquals(encoding, location.encoding); |
| 21 } | 24 } |
| 25 |
| 22 void test_equals_equal() { | 26 void test_equals_equal() { |
| 23 String encoding = "a;b;c"; | 27 String encoding = "a;b;c"; |
| 24 ElementLocationImpl first = new ElementLocationImpl.con2(encoding); | 28 ElementLocationImpl first = new ElementLocationImpl.con2(encoding); |
| 25 ElementLocationImpl second = new ElementLocationImpl.con2(encoding); | 29 ElementLocationImpl second = new ElementLocationImpl.con2(encoding); |
| 26 JUnitTestCase.assertTrue(first == second); | 30 JUnitTestCase.assertTrue(first == second); |
| 27 } | 31 } |
| 32 |
| 28 void test_equals_equalWithDifferentUriKind() { | 33 void test_equals_equalWithDifferentUriKind() { |
| 29 ElementLocationImpl first = new ElementLocationImpl.con2("fa;fb;c"); | 34 ElementLocationImpl first = new ElementLocationImpl.con2("fa;fb;c"); |
| 30 ElementLocationImpl second = new ElementLocationImpl.con2("pa;pb;c"); | 35 ElementLocationImpl second = new ElementLocationImpl.con2("pa;pb;c"); |
| 31 JUnitTestCase.assertTrue(first == second); | 36 JUnitTestCase.assertTrue(first == second); |
| 32 } | 37 } |
| 38 |
| 33 void test_equals_notEqual_differentLengths() { | 39 void test_equals_notEqual_differentLengths() { |
| 34 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c"); | 40 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c"); |
| 35 ElementLocationImpl second = new ElementLocationImpl.con2("a;b;c;d"); | 41 ElementLocationImpl second = new ElementLocationImpl.con2("a;b;c;d"); |
| 36 JUnitTestCase.assertFalse(first == second); | 42 JUnitTestCase.assertFalse(first == second); |
| 37 } | 43 } |
| 44 |
| 38 void test_equals_notEqual_notLocation() { | 45 void test_equals_notEqual_notLocation() { |
| 39 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c"); | 46 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c"); |
| 40 JUnitTestCase.assertFalse(first == "a;b;d"); | 47 JUnitTestCase.assertFalse(first == "a;b;d"); |
| 41 } | 48 } |
| 49 |
| 42 void test_equals_notEqual_sameLengths() { | 50 void test_equals_notEqual_sameLengths() { |
| 43 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c"); | 51 ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c"); |
| 44 ElementLocationImpl second = new ElementLocationImpl.con2("a;b;d"); | 52 ElementLocationImpl second = new ElementLocationImpl.con2("a;b;d"); |
| 45 JUnitTestCase.assertFalse(first == second); | 53 JUnitTestCase.assertFalse(first == second); |
| 46 } | 54 } |
| 55 |
| 47 void test_getComponents() { | 56 void test_getComponents() { |
| 48 String encoding = "a;b;c"; | 57 String encoding = "a;b;c"; |
| 49 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); | 58 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); |
| 50 List<String> components = location.components; | 59 List<String> components = location.components; |
| 51 EngineTestCase.assertLength(3, components); | 60 EngineTestCase.assertLength(3, components); |
| 52 JUnitTestCase.assertEquals("a", components[0]); | 61 JUnitTestCase.assertEquals("a", components[0]); |
| 53 JUnitTestCase.assertEquals("b", components[1]); | 62 JUnitTestCase.assertEquals("b", components[1]); |
| 54 JUnitTestCase.assertEquals("c", components[2]); | 63 JUnitTestCase.assertEquals("c", components[2]); |
| 55 } | 64 } |
| 65 |
| 56 void test_getEncoding() { | 66 void test_getEncoding() { |
| 57 String encoding = "a;b;c;;d"; | 67 String encoding = "a;b;c;;d"; |
| 58 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); | 68 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); |
| 59 JUnitTestCase.assertEquals(encoding, location.encoding); | 69 JUnitTestCase.assertEquals(encoding, location.encoding); |
| 60 } | 70 } |
| 71 |
| 61 void test_hashCode_equal() { | 72 void test_hashCode_equal() { |
| 62 String encoding = "a;b;c"; | 73 String encoding = "a;b;c"; |
| 63 ElementLocationImpl first = new ElementLocationImpl.con2(encoding); | 74 ElementLocationImpl first = new ElementLocationImpl.con2(encoding); |
| 64 ElementLocationImpl second = new ElementLocationImpl.con2(encoding); | 75 ElementLocationImpl second = new ElementLocationImpl.con2(encoding); |
| 65 JUnitTestCase.assertTrue(first.hashCode == second.hashCode); | 76 JUnitTestCase.assertTrue(first.hashCode == second.hashCode); |
| 66 } | 77 } |
| 78 |
| 67 void test_hashCode_equalWithDifferentUriKind() { | 79 void test_hashCode_equalWithDifferentUriKind() { |
| 68 ElementLocationImpl first = new ElementLocationImpl.con2("fa;fb;c"); | 80 ElementLocationImpl first = new ElementLocationImpl.con2("fa;fb;c"); |
| 69 ElementLocationImpl second = new ElementLocationImpl.con2("pa;pb;c"); | 81 ElementLocationImpl second = new ElementLocationImpl.con2("pa;pb;c"); |
| 70 JUnitTestCase.assertTrue(first.hashCode == second.hashCode); | 82 JUnitTestCase.assertTrue(first.hashCode == second.hashCode); |
| 71 } | 83 } |
| 84 |
| 72 static dartSuite() { | 85 static dartSuite() { |
| 73 _ut.group('ElementLocationImplTest', () { | 86 _ut.group('ElementLocationImplTest', () { |
| 74 _ut.test('test_create_encoding', () { | 87 _ut.test('test_create_encoding', () { |
| 75 final __test = new ElementLocationImplTest(); | 88 final __test = new ElementLocationImplTest(); |
| 76 runJUnitTest(__test, __test.test_create_encoding); | 89 runJUnitTest(__test, __test.test_create_encoding); |
| 77 }); | 90 }); |
| 78 _ut.test('test_equals_equal', () { | 91 _ut.test('test_equals_equal', () { |
| 79 final __test = new ElementLocationImplTest(); | 92 final __test = new ElementLocationImplTest(); |
| 80 runJUnitTest(__test, __test.test_equals_equal); | 93 runJUnitTest(__test, __test.test_equals_equal); |
| 81 }); | 94 }); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 107 final __test = new ElementLocationImplTest(); | 120 final __test = new ElementLocationImplTest(); |
| 108 runJUnitTest(__test, __test.test_hashCode_equal); | 121 runJUnitTest(__test, __test.test_hashCode_equal); |
| 109 }); | 122 }); |
| 110 _ut.test('test_hashCode_equalWithDifferentUriKind', () { | 123 _ut.test('test_hashCode_equalWithDifferentUriKind', () { |
| 111 final __test = new ElementLocationImplTest(); | 124 final __test = new ElementLocationImplTest(); |
| 112 runJUnitTest(__test, __test.test_hashCode_equalWithDifferentUriKind); | 125 runJUnitTest(__test, __test.test_hashCode_equalWithDifferentUriKind); |
| 113 }); | 126 }); |
| 114 }); | 127 }); |
| 115 } | 128 } |
| 116 } | 129 } |
| 130 |
| 117 class MultiplyDefinedElementImplTest extends EngineTestCase { | 131 class MultiplyDefinedElementImplTest extends EngineTestCase { |
| 118 void test_fromElements_conflicting() { | 132 void test_fromElements_conflicting() { |
| 119 Element firstElement = ElementFactory.localVariableElement2("xx"); | 133 Element firstElement = ElementFactory.localVariableElement2("xx"); |
| 120 Element secondElement = ElementFactory.localVariableElement2("yy"); | 134 Element secondElement = ElementFactory.localVariableElement2("yy"); |
| 121 Element result = MultiplyDefinedElementImpl.fromElements(null, firstElement,
secondElement); | 135 Element result = MultiplyDefinedElementImpl.fromElements(null, firstElement,
secondElement); |
| 122 EngineTestCase.assertInstanceOf(MultiplyDefinedElement, result); | 136 EngineTestCase.assertInstanceOf(MultiplyDefinedElement, result); |
| 123 List<Element> elements = ((result as MultiplyDefinedElement)).conflictingEle
ments; | 137 List<Element> elements = (result as MultiplyDefinedElement).conflictingEleme
nts; |
| 124 EngineTestCase.assertLength(2, elements); | 138 EngineTestCase.assertLength(2, elements); |
| 125 for (int i = 0; i < elements.length; i++) { | 139 for (int i = 0; i < elements.length; i++) { |
| 126 EngineTestCase.assertInstanceOf(LocalVariableElement, elements[i]); | 140 EngineTestCase.assertInstanceOf(LocalVariableElement, elements[i]); |
| 127 } | 141 } |
| 128 } | 142 } |
| 143 |
| 129 void test_fromElements_multiple() { | 144 void test_fromElements_multiple() { |
| 130 Element firstElement = ElementFactory.localVariableElement2("xx"); | 145 Element firstElement = ElementFactory.localVariableElement2("xx"); |
| 131 Element secondElement = ElementFactory.localVariableElement2("yy"); | 146 Element secondElement = ElementFactory.localVariableElement2("yy"); |
| 132 Element thirdElement = ElementFactory.localVariableElement2("zz"); | 147 Element thirdElement = ElementFactory.localVariableElement2("zz"); |
| 133 Element result = MultiplyDefinedElementImpl.fromElements(null, MultiplyDefin
edElementImpl.fromElements(null, firstElement, secondElement), thirdElement); | 148 Element result = MultiplyDefinedElementImpl.fromElements(null, MultiplyDefin
edElementImpl.fromElements(null, firstElement, secondElement), thirdElement); |
| 134 EngineTestCase.assertInstanceOf(MultiplyDefinedElement, result); | 149 EngineTestCase.assertInstanceOf(MultiplyDefinedElement, result); |
| 135 List<Element> elements = ((result as MultiplyDefinedElement)).conflictingEle
ments; | 150 List<Element> elements = (result as MultiplyDefinedElement).conflictingEleme
nts; |
| 136 EngineTestCase.assertLength(3, elements); | 151 EngineTestCase.assertLength(3, elements); |
| 137 for (int i = 0; i < elements.length; i++) { | 152 for (int i = 0; i < elements.length; i++) { |
| 138 EngineTestCase.assertInstanceOf(LocalVariableElement, elements[i]); | 153 EngineTestCase.assertInstanceOf(LocalVariableElement, elements[i]); |
| 139 } | 154 } |
| 140 } | 155 } |
| 156 |
| 141 void test_fromElements_nonConflicting() { | 157 void test_fromElements_nonConflicting() { |
| 142 Element element = ElementFactory.localVariableElement2("xx"); | 158 Element element = ElementFactory.localVariableElement2("xx"); |
| 143 JUnitTestCase.assertSame(element, MultiplyDefinedElementImpl.fromElements(nu
ll, element, element)); | 159 JUnitTestCase.assertSame(element, MultiplyDefinedElementImpl.fromElements(nu
ll, element, element)); |
| 144 } | 160 } |
| 161 |
| 145 static dartSuite() { | 162 static dartSuite() { |
| 146 _ut.group('MultiplyDefinedElementImplTest', () { | 163 _ut.group('MultiplyDefinedElementImplTest', () { |
| 147 _ut.test('test_fromElements_conflicting', () { | 164 _ut.test('test_fromElements_conflicting', () { |
| 148 final __test = new MultiplyDefinedElementImplTest(); | 165 final __test = new MultiplyDefinedElementImplTest(); |
| 149 runJUnitTest(__test, __test.test_fromElements_conflicting); | 166 runJUnitTest(__test, __test.test_fromElements_conflicting); |
| 150 }); | 167 }); |
| 151 _ut.test('test_fromElements_multiple', () { | 168 _ut.test('test_fromElements_multiple', () { |
| 152 final __test = new MultiplyDefinedElementImplTest(); | 169 final __test = new MultiplyDefinedElementImplTest(); |
| 153 runJUnitTest(__test, __test.test_fromElements_multiple); | 170 runJUnitTest(__test, __test.test_fromElements_multiple); |
| 154 }); | 171 }); |
| 155 _ut.test('test_fromElements_nonConflicting', () { | 172 _ut.test('test_fromElements_nonConflicting', () { |
| 156 final __test = new MultiplyDefinedElementImplTest(); | 173 final __test = new MultiplyDefinedElementImplTest(); |
| 157 runJUnitTest(__test, __test.test_fromElements_nonConflicting); | 174 runJUnitTest(__test, __test.test_fromElements_nonConflicting); |
| 158 }); | 175 }); |
| 159 }); | 176 }); |
| 160 } | 177 } |
| 161 } | 178 } |
| 179 |
| 162 class LibraryElementImplTest extends EngineTestCase { | 180 class LibraryElementImplTest extends EngineTestCase { |
| 163 void test_creation() { | 181 void test_creation() { |
| 164 JUnitTestCase.assertNotNull(new LibraryElementImpl(createAnalysisContext(),
ASTFactory.libraryIdentifier2(["l"]))); | 182 JUnitTestCase.assertNotNull(new LibraryElementImpl(createAnalysisContext(),
ASTFactory.libraryIdentifier2(["l"]))); |
| 165 } | 183 } |
| 184 |
| 166 void test_getImportedLibraries() { | 185 void test_getImportedLibraries() { |
| 167 AnalysisContext context = createAnalysisContext(); | 186 AnalysisContext context = createAnalysisContext(); |
| 168 LibraryElementImpl library1 = ElementFactory.library(context, "l1"); | 187 LibraryElementImpl library1 = ElementFactory.library(context, "l1"); |
| 169 LibraryElementImpl library2 = ElementFactory.library(context, "l2"); | 188 LibraryElementImpl library2 = ElementFactory.library(context, "l2"); |
| 170 LibraryElementImpl library3 = ElementFactory.library(context, "l3"); | 189 LibraryElementImpl library3 = ElementFactory.library(context, "l3"); |
| 171 LibraryElementImpl library4 = ElementFactory.library(context, "l4"); | 190 LibraryElementImpl library4 = ElementFactory.library(context, "l4"); |
| 172 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); | 191 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); |
| 173 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); | 192 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); |
| 174 List<ImportElementImpl> imports = [ | 193 List<ImportElementImpl> imports = [ |
| 175 ElementFactory.importFor(library2, null, []), | 194 ElementFactory.importFor(library2, null, []), |
| 176 ElementFactory.importFor(library2, prefixB, []), | 195 ElementFactory.importFor(library2, prefixB, []), |
| 177 ElementFactory.importFor(library3, null, []), | 196 ElementFactory.importFor(library3, null, []), |
| 178 ElementFactory.importFor(library3, prefixA, []), | 197 ElementFactory.importFor(library3, prefixA, []), |
| 179 ElementFactory.importFor(library3, prefixB, []), | 198 ElementFactory.importFor(library3, prefixB, []), |
| 180 ElementFactory.importFor(library4, prefixA, [])]; | 199 ElementFactory.importFor(library4, prefixA, [])]; |
| 181 library1.imports = imports; | 200 library1.imports = imports; |
| 182 List<LibraryElement> libraries = library1.importedLibraries; | 201 List<LibraryElement> libraries = library1.importedLibraries; |
| 183 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library2, library3,
library4], libraries); | 202 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library2, library3,
library4], libraries); |
| 184 } | 203 } |
| 204 |
| 185 void test_getPrefixes() { | 205 void test_getPrefixes() { |
| 186 AnalysisContext context = createAnalysisContext(); | 206 AnalysisContext context = createAnalysisContext(); |
| 187 LibraryElementImpl library = ElementFactory.library(context, "l1"); | 207 LibraryElementImpl library = ElementFactory.library(context, "l1"); |
| 188 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); | 208 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); |
| 189 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); | 209 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); |
| 190 List<ImportElementImpl> imports = [ | 210 List<ImportElementImpl> imports = [ |
| 191 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), | 211 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), |
| 192 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
), | 212 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
), |
| 193 ElementFactory.importFor(ElementFactory.library(context, "l4"), prefixA,
[]), | 213 ElementFactory.importFor(ElementFactory.library(context, "l4"), prefixA,
[]), |
| 194 ElementFactory.importFor(ElementFactory.library(context, "l5"), prefixA,
[]), | 214 ElementFactory.importFor(ElementFactory.library(context, "l5"), prefixA,
[]), |
| 195 ElementFactory.importFor(ElementFactory.library(context, "l6"), prefixB,
[])]; | 215 ElementFactory.importFor(ElementFactory.library(context, "l6"), prefixB,
[])]; |
| 196 library.imports = imports; | 216 library.imports = imports; |
| 197 List<PrefixElement> prefixes = library.prefixes; | 217 List<PrefixElement> prefixes = library.prefixes; |
| 198 EngineTestCase.assertLength(2, prefixes); | 218 EngineTestCase.assertLength(2, prefixes); |
| 199 if (identical(prefixA, prefixes[0])) { | 219 if (identical(prefixA, prefixes[0])) { |
| 200 JUnitTestCase.assertSame(prefixB, prefixes[1]); | 220 JUnitTestCase.assertSame(prefixB, prefixes[1]); |
| 201 } else { | 221 } else { |
| 202 JUnitTestCase.assertSame(prefixB, prefixes[0]); | 222 JUnitTestCase.assertSame(prefixB, prefixes[0]); |
| 203 JUnitTestCase.assertSame(prefixA, prefixes[1]); | 223 JUnitTestCase.assertSame(prefixA, prefixes[1]); |
| 204 } | 224 } |
| 205 } | 225 } |
| 226 |
| 206 void test_isUpToDate() { | 227 void test_isUpToDate() { |
| 207 AnalysisContext context = createAnalysisContext(); | 228 AnalysisContext context = createAnalysisContext(); |
| 208 context.sourceFactory = new SourceFactory.con2([]); | 229 context.sourceFactory = new SourceFactory.con2([]); |
| 209 LibraryElement library = ElementFactory.library(context, "foo"); | 230 LibraryElement library = ElementFactory.library(context, "foo"); |
| 210 context.sourceFactory.setContents(library.definingCompilationUnit.source, "s
dfsdff"); | 231 context.sourceFactory.setContents(library.definingCompilationUnit.source, "s
dfsdff"); |
| 211 JUnitTestCase.assertFalse(library.isUpToDate2(0)); | 232 JUnitTestCase.assertFalse(library.isUpToDate2(0)); |
| 212 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); | 233 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); |
| 213 } | 234 } |
| 235 |
| 214 void test_setImports() { | 236 void test_setImports() { |
| 215 AnalysisContext context = createAnalysisContext(); | 237 AnalysisContext context = createAnalysisContext(); |
| 216 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["l1"])); | 238 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["l1"])); |
| 217 List<ImportElementImpl> expectedImports = [ | 239 List<ImportElementImpl> expectedImports = [ |
| 218 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), | 240 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), |
| 219 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
)]; | 241 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
)]; |
| 220 library.imports = expectedImports; | 242 library.imports = expectedImports; |
| 221 List<ImportElement> actualImports = library.imports; | 243 List<ImportElement> actualImports = library.imports; |
| 222 EngineTestCase.assertLength(expectedImports.length, actualImports); | 244 EngineTestCase.assertLength(expectedImports.length, actualImports); |
| 223 for (int i = 0; i < actualImports.length; i++) { | 245 for (int i = 0; i < actualImports.length; i++) { |
| 224 JUnitTestCase.assertSame(expectedImports[i], actualImports[i]); | 246 JUnitTestCase.assertSame(expectedImports[i], actualImports[i]); |
| 225 } | 247 } |
| 226 } | 248 } |
| 249 |
| 227 static dartSuite() { | 250 static dartSuite() { |
| 228 _ut.group('LibraryElementImplTest', () { | 251 _ut.group('LibraryElementImplTest', () { |
| 229 _ut.test('test_creation', () { | 252 _ut.test('test_creation', () { |
| 230 final __test = new LibraryElementImplTest(); | 253 final __test = new LibraryElementImplTest(); |
| 231 runJUnitTest(__test, __test.test_creation); | 254 runJUnitTest(__test, __test.test_creation); |
| 232 }); | 255 }); |
| 233 _ut.test('test_getImportedLibraries', () { | 256 _ut.test('test_getImportedLibraries', () { |
| 234 final __test = new LibraryElementImplTest(); | 257 final __test = new LibraryElementImplTest(); |
| 235 runJUnitTest(__test, __test.test_getImportedLibraries); | 258 runJUnitTest(__test, __test.test_getImportedLibraries); |
| 236 }); | 259 }); |
| 237 _ut.test('test_getPrefixes', () { | 260 _ut.test('test_getPrefixes', () { |
| 238 final __test = new LibraryElementImplTest(); | 261 final __test = new LibraryElementImplTest(); |
| 239 runJUnitTest(__test, __test.test_getPrefixes); | 262 runJUnitTest(__test, __test.test_getPrefixes); |
| 240 }); | 263 }); |
| 241 _ut.test('test_isUpToDate', () { | 264 _ut.test('test_isUpToDate', () { |
| 242 final __test = new LibraryElementImplTest(); | 265 final __test = new LibraryElementImplTest(); |
| 243 runJUnitTest(__test, __test.test_isUpToDate); | 266 runJUnitTest(__test, __test.test_isUpToDate); |
| 244 }); | 267 }); |
| 245 _ut.test('test_setImports', () { | 268 _ut.test('test_setImports', () { |
| 246 final __test = new LibraryElementImplTest(); | 269 final __test = new LibraryElementImplTest(); |
| 247 runJUnitTest(__test, __test.test_setImports); | 270 runJUnitTest(__test, __test.test_setImports); |
| 248 }); | 271 }); |
| 249 }); | 272 }); |
| 250 } | 273 } |
| 251 } | 274 } |
| 275 |
| 252 class TypeParameterTypeImplTest extends EngineTestCase { | 276 class TypeParameterTypeImplTest extends EngineTestCase { |
| 253 void test_creation() { | 277 void test_creation() { |
| 254 JUnitTestCase.assertNotNull(new TypeParameterTypeImpl(new TypeParameterEleme
ntImpl(ASTFactory.identifier3("E")))); | 278 JUnitTestCase.assertNotNull(new TypeParameterTypeImpl(new TypeParameterEleme
ntImpl(ASTFactory.identifier3("E")))); |
| 255 } | 279 } |
| 280 |
| 256 void test_getElement() { | 281 void test_getElement() { |
| 257 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 282 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 258 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 283 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 259 JUnitTestCase.assertEquals(element, type.element); | 284 JUnitTestCase.assertEquals(element, type.element); |
| 260 } | 285 } |
| 286 |
| 261 void test_isMoreSpecificThan_typeArguments_bottom() { | 287 void test_isMoreSpecificThan_typeArguments_bottom() { |
| 262 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 288 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 263 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 289 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 264 JUnitTestCase.assertTrue(type.isMoreSpecificThan(BottomTypeImpl.instance)); | 290 JUnitTestCase.assertTrue(type.isMoreSpecificThan(BottomTypeImpl.instance)); |
| 265 } | 291 } |
| 292 |
| 266 void test_isMoreSpecificThan_typeArguments_dynamic() { | 293 void test_isMoreSpecificThan_typeArguments_dynamic() { |
| 267 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 294 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 268 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 295 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 269 JUnitTestCase.assertTrue(type.isMoreSpecificThan(DynamicTypeImpl.instance)); | 296 JUnitTestCase.assertTrue(type.isMoreSpecificThan(DynamicTypeImpl.instance)); |
| 270 } | 297 } |
| 298 |
| 271 void test_isMoreSpecificThan_typeArguments_object() { | 299 void test_isMoreSpecificThan_typeArguments_object() { |
| 272 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 300 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 273 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 301 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 274 JUnitTestCase.assertTrue(type.isMoreSpecificThan(ElementFactory.object.type)
); | 302 JUnitTestCase.assertTrue(type.isMoreSpecificThan(ElementFactory.object.type)
); |
| 275 } | 303 } |
| 304 |
| 276 void test_isMoreSpecificThan_typeArguments_resursive() { | 305 void test_isMoreSpecificThan_typeArguments_resursive() { |
| 277 ClassElementImpl classS = ElementFactory.classElement2("A", []); | 306 ClassElementImpl classS = ElementFactory.classElement2("A", []); |
| 278 TypeParameterElementImpl typeParameterU = new TypeParameterElementImpl(ASTFa
ctory.identifier3("U")); | 307 TypeParameterElementImpl typeParameterU = new TypeParameterElementImpl(ASTFa
ctory.identifier3("U")); |
| 279 TypeParameterTypeImpl typeParameterTypeU = new TypeParameterTypeImpl(typePar
ameterU); | 308 TypeParameterTypeImpl typeParameterTypeU = new TypeParameterTypeImpl(typePar
ameterU); |
| 280 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); | 309 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); |
| 281 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); | 310 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); |
| 282 typeParameterT.bound = typeParameterTypeU; | 311 typeParameterT.bound = typeParameterTypeU; |
| 283 typeParameterU.bound = typeParameterTypeU; | 312 typeParameterU.bound = typeParameterTypeU; |
| 284 JUnitTestCase.assertFalse(typeParameterTypeT.isMoreSpecificThan(classS.type)
); | 313 JUnitTestCase.assertFalse(typeParameterTypeT.isMoreSpecificThan(classS.type)
); |
| 285 } | 314 } |
| 315 |
| 286 void test_isMoreSpecificThan_typeArguments_self() { | 316 void test_isMoreSpecificThan_typeArguments_self() { |
| 287 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 317 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 288 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 318 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 289 JUnitTestCase.assertTrue(type.isMoreSpecificThan(type)); | 319 JUnitTestCase.assertTrue(type.isMoreSpecificThan(type)); |
| 290 } | 320 } |
| 321 |
| 291 void test_isMoreSpecificThan_typeArguments_transitivity_interfaceTypes() { | 322 void test_isMoreSpecificThan_typeArguments_transitivity_interfaceTypes() { |
| 292 ClassElement classA = ElementFactory.classElement2("A", []); | 323 ClassElement classA = ElementFactory.classElement2("A", []); |
| 293 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 324 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 294 InterfaceType typeA = classA.type; | 325 InterfaceType typeA = classA.type; |
| 295 InterfaceType typeB = classB.type; | 326 InterfaceType typeB = classB.type; |
| 296 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); | 327 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); |
| 297 typeParameterT.bound = typeB; | 328 typeParameterT.bound = typeB; |
| 298 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); | 329 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); |
| 299 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(typeA)); | 330 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(typeA)); |
| 300 } | 331 } |
| 332 |
| 301 void test_isMoreSpecificThan_typeArguments_transitivity_typeParameters() { | 333 void test_isMoreSpecificThan_typeArguments_transitivity_typeParameters() { |
| 302 ClassElementImpl classS = ElementFactory.classElement2("A", []); | 334 ClassElementImpl classS = ElementFactory.classElement2("A", []); |
| 303 TypeParameterElementImpl typeParameterU = new TypeParameterElementImpl(ASTFa
ctory.identifier3("U")); | 335 TypeParameterElementImpl typeParameterU = new TypeParameterElementImpl(ASTFa
ctory.identifier3("U")); |
| 304 typeParameterU.bound = classS.type; | 336 typeParameterU.bound = classS.type; |
| 305 TypeParameterTypeImpl typeParameterTypeU = new TypeParameterTypeImpl(typePar
ameterU); | 337 TypeParameterTypeImpl typeParameterTypeU = new TypeParameterTypeImpl(typePar
ameterU); |
| 306 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); | 338 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); |
| 307 typeParameterT.bound = typeParameterTypeU; | 339 typeParameterT.bound = typeParameterTypeU; |
| 308 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); | 340 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); |
| 309 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(classS.type))
; | 341 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(classS.type))
; |
| 310 } | 342 } |
| 343 |
| 311 void test_isMoreSpecificThan_typeArguments_upperBound() { | 344 void test_isMoreSpecificThan_typeArguments_upperBound() { |
| 312 ClassElementImpl classS = ElementFactory.classElement2("A", []); | 345 ClassElementImpl classS = ElementFactory.classElement2("A", []); |
| 313 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); | 346 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); |
| 314 typeParameterT.bound = classS.type; | 347 typeParameterT.bound = classS.type; |
| 315 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); | 348 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); |
| 316 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(classS.type))
; | 349 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(classS.type))
; |
| 317 } | 350 } |
| 351 |
| 318 void test_substitute_equal() { | 352 void test_substitute_equal() { |
| 319 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 353 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 320 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 354 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 321 InterfaceTypeImpl argument = new InterfaceTypeImpl.con1(new ClassElementImpl
(ASTFactory.identifier3("A"))); | 355 InterfaceTypeImpl argument = new InterfaceTypeImpl.con1(new ClassElementImpl
(ASTFactory.identifier3("A"))); |
| 322 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(element); | 356 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(element); |
| 323 JUnitTestCase.assertSame(argument, type.substitute2(<Type2> [argument], <Typ
e2> [parameter])); | 357 JUnitTestCase.assertSame(argument, type.substitute2(<Type2> [argument], <Typ
e2> [parameter])); |
| 324 } | 358 } |
| 359 |
| 325 void test_substitute_notEqual() { | 360 void test_substitute_notEqual() { |
| 326 TypeParameterTypeImpl type = new TypeParameterTypeImpl(new TypeParameterElem
entImpl(ASTFactory.identifier3("E"))); | 361 TypeParameterTypeImpl type = new TypeParameterTypeImpl(new TypeParameterElem
entImpl(ASTFactory.identifier3("E"))); |
| 327 InterfaceTypeImpl argument = new InterfaceTypeImpl.con1(new ClassElementImpl
(ASTFactory.identifier3("A"))); | 362 InterfaceTypeImpl argument = new InterfaceTypeImpl.con1(new ClassElementImpl
(ASTFactory.identifier3("A"))); |
| 328 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(new TypeParamete
rElementImpl(ASTFactory.identifier3("F"))); | 363 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(new TypeParamete
rElementImpl(ASTFactory.identifier3("F"))); |
| 329 JUnitTestCase.assertSame(type, type.substitute2(<Type2> [argument], <Type2>
[parameter])); | 364 JUnitTestCase.assertSame(type, type.substitute2(<Type2> [argument], <Type2>
[parameter])); |
| 330 } | 365 } |
| 366 |
| 331 static dartSuite() { | 367 static dartSuite() { |
| 332 _ut.group('TypeParameterTypeImplTest', () { | 368 _ut.group('TypeParameterTypeImplTest', () { |
| 333 _ut.test('test_creation', () { | 369 _ut.test('test_creation', () { |
| 334 final __test = new TypeParameterTypeImplTest(); | 370 final __test = new TypeParameterTypeImplTest(); |
| 335 runJUnitTest(__test, __test.test_creation); | 371 runJUnitTest(__test, __test.test_creation); |
| 336 }); | 372 }); |
| 337 _ut.test('test_getElement', () { | 373 _ut.test('test_getElement', () { |
| 338 final __test = new TypeParameterTypeImplTest(); | 374 final __test = new TypeParameterTypeImplTest(); |
| 339 runJUnitTest(__test, __test.test_getElement); | 375 runJUnitTest(__test, __test.test_getElement); |
| 340 }); | 376 }); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 final __test = new TypeParameterTypeImplTest(); | 410 final __test = new TypeParameterTypeImplTest(); |
| 375 runJUnitTest(__test, __test.test_substitute_equal); | 411 runJUnitTest(__test, __test.test_substitute_equal); |
| 376 }); | 412 }); |
| 377 _ut.test('test_substitute_notEqual', () { | 413 _ut.test('test_substitute_notEqual', () { |
| 378 final __test = new TypeParameterTypeImplTest(); | 414 final __test = new TypeParameterTypeImplTest(); |
| 379 runJUnitTest(__test, __test.test_substitute_notEqual); | 415 runJUnitTest(__test, __test.test_substitute_notEqual); |
| 380 }); | 416 }); |
| 381 }); | 417 }); |
| 382 } | 418 } |
| 383 } | 419 } |
| 420 |
| 384 class InterfaceTypeImplTest extends EngineTestCase { | 421 class InterfaceTypeImplTest extends EngineTestCase { |
| 385 | |
| 386 /** | 422 /** |
| 387 * The type provider used to access the types. | 423 * The type provider used to access the types. |
| 388 */ | 424 */ |
| 389 TestTypeProvider _typeProvider; | 425 TestTypeProvider _typeProvider; |
| 426 |
| 390 void setUp() { | 427 void setUp() { |
| 391 _typeProvider = new TestTypeProvider(); | 428 _typeProvider = new TestTypeProvider(); |
| 392 } | 429 } |
| 430 |
| 393 void test_computeLongestInheritancePathToObject_multipleInterfacePaths() { | 431 void test_computeLongestInheritancePathToObject_multipleInterfacePaths() { |
| 394 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 432 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 395 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 433 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 396 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 434 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 397 ClassElementImpl classD = ElementFactory.classElement2("D", []); | 435 ClassElementImpl classD = ElementFactory.classElement2("D", []); |
| 398 ClassElementImpl classE = ElementFactory.classElement2("E", []); | 436 ClassElementImpl classE = ElementFactory.classElement2("E", []); |
| 399 classB.interfaces = <InterfaceType> [classA.type]; | 437 classB.interfaces = <InterfaceType> [classA.type]; |
| 400 classC.interfaces = <InterfaceType> [classA.type]; | 438 classC.interfaces = <InterfaceType> [classA.type]; |
| 401 classD.interfaces = <InterfaceType> [classC.type]; | 439 classD.interfaces = <InterfaceType> [classC.type]; |
| 402 classE.interfaces = <InterfaceType> [classB.type, classD.type]; | 440 classE.interfaces = <InterfaceType> [classB.type, classD.type]; |
| 403 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); | 441 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); |
| 404 JUnitTestCase.assertEquals(4, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classE.type)); | 442 JUnitTestCase.assertEquals(4, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classE.type)); |
| 405 } | 443 } |
| 444 |
| 406 void test_computeLongestInheritancePathToObject_multipleSuperclassPaths() { | 445 void test_computeLongestInheritancePathToObject_multipleSuperclassPaths() { |
| 407 ClassElement classA = ElementFactory.classElement2("A", []); | 446 ClassElement classA = ElementFactory.classElement2("A", []); |
| 408 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 447 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 409 ClassElement classC = ElementFactory.classElement("C", classA.type, []); | 448 ClassElement classC = ElementFactory.classElement("C", classA.type, []); |
| 410 ClassElement classD = ElementFactory.classElement("D", classC.type, []); | 449 ClassElement classD = ElementFactory.classElement("D", classC.type, []); |
| 411 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); | 450 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); |
| 412 classE.interfaces = <InterfaceType> [classD.type]; | 451 classE.interfaces = <InterfaceType> [classD.type]; |
| 413 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); | 452 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); |
| 414 JUnitTestCase.assertEquals(4, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classE.type)); | 453 JUnitTestCase.assertEquals(4, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classE.type)); |
| 415 } | 454 } |
| 455 |
| 416 void test_computeLongestInheritancePathToObject_object() { | 456 void test_computeLongestInheritancePathToObject_object() { |
| 417 ClassElement classA = ElementFactory.classElement2("A", []); | 457 ClassElement classA = ElementFactory.classElement2("A", []); |
| 418 InterfaceType object = classA.supertype; | 458 InterfaceType object = classA.supertype; |
| 419 JUnitTestCase.assertEquals(0, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(object)); | 459 JUnitTestCase.assertEquals(0, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(object)); |
| 420 } | 460 } |
| 461 |
| 421 void test_computeLongestInheritancePathToObject_recursion() { | 462 void test_computeLongestInheritancePathToObject_recursion() { |
| 422 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 463 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 423 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 464 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 424 classA.supertype = classB.type; | 465 classA.supertype = classB.type; |
| 425 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); | 466 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); |
| 426 } | 467 } |
| 468 |
| 427 void test_computeLongestInheritancePathToObject_singleInterfacePath() { | 469 void test_computeLongestInheritancePathToObject_singleInterfacePath() { |
| 428 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 470 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 429 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 471 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 430 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 472 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 431 classB.interfaces = <InterfaceType> [classA.type]; | 473 classB.interfaces = <InterfaceType> [classA.type]; |
| 432 classC.interfaces = <InterfaceType> [classB.type]; | 474 classC.interfaces = <InterfaceType> [classB.type]; |
| 433 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); | 475 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); |
| 434 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); | 476 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); |
| 435 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); | 477 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); |
| 436 } | 478 } |
| 479 |
| 437 void test_computeLongestInheritancePathToObject_singleSuperclassPath() { | 480 void test_computeLongestInheritancePathToObject_singleSuperclassPath() { |
| 438 ClassElement classA = ElementFactory.classElement2("A", []); | 481 ClassElement classA = ElementFactory.classElement2("A", []); |
| 439 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 482 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 440 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 483 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
| 441 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); | 484 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); |
| 442 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); | 485 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); |
| 443 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); | 486 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); |
| 444 } | 487 } |
| 488 |
| 445 void test_computeSuperinterfaceSet_multipleInterfacePaths() { | 489 void test_computeSuperinterfaceSet_multipleInterfacePaths() { |
| 446 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 490 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 447 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 491 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 448 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 492 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 449 ClassElementImpl classD = ElementFactory.classElement2("D", []); | 493 ClassElementImpl classD = ElementFactory.classElement2("D", []); |
| 450 ClassElementImpl classE = ElementFactory.classElement2("E", []); | 494 ClassElementImpl classE = ElementFactory.classElement2("E", []); |
| 451 classB.interfaces = <InterfaceType> [classA.type]; | 495 classB.interfaces = <InterfaceType> [classA.type]; |
| 452 classC.interfaces = <InterfaceType> [classA.type]; | 496 classC.interfaces = <InterfaceType> [classA.type]; |
| 453 classD.interfaces = <InterfaceType> [classC.type]; | 497 classD.interfaces = <InterfaceType> [classC.type]; |
| 454 classE.interfaces = <InterfaceType> [classB.type, classD.type]; | 498 classE.interfaces = <InterfaceType> [classB.type, classD.type]; |
| 455 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); | 499 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); |
| 456 EngineTestCase.assertSize3(3, superinterfacesOfD); | 500 EngineTestCase.assertSize3(3, superinterfacesOfD); |
| 457 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); | 501 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); |
| 458 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); | 502 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); |
| 459 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); | 503 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); |
| 460 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); | 504 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); |
| 461 EngineTestCase.assertSize3(5, superinterfacesOfE); | 505 EngineTestCase.assertSize3(5, superinterfacesOfE); |
| 462 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); | 506 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); |
| 463 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); | 507 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); |
| 464 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); | 508 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); |
| 465 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); | 509 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); |
| 466 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); | 510 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); |
| 467 } | 511 } |
| 512 |
| 468 void test_computeSuperinterfaceSet_multipleSuperclassPaths() { | 513 void test_computeSuperinterfaceSet_multipleSuperclassPaths() { |
| 469 ClassElement classA = ElementFactory.classElement2("A", []); | 514 ClassElement classA = ElementFactory.classElement2("A", []); |
| 470 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 515 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 471 ClassElement classC = ElementFactory.classElement("C", classA.type, []); | 516 ClassElement classC = ElementFactory.classElement("C", classA.type, []); |
| 472 ClassElement classD = ElementFactory.classElement("D", classC.type, []); | 517 ClassElement classD = ElementFactory.classElement("D", classC.type, []); |
| 473 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); | 518 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); |
| 474 classE.interfaces = <InterfaceType> [classD.type]; | 519 classE.interfaces = <InterfaceType> [classD.type]; |
| 475 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); | 520 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); |
| 476 EngineTestCase.assertSize3(3, superinterfacesOfD); | 521 EngineTestCase.assertSize3(3, superinterfacesOfD); |
| 477 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); | 522 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); |
| 478 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); | 523 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); |
| 479 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); | 524 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); |
| 480 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); | 525 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); |
| 481 EngineTestCase.assertSize3(5, superinterfacesOfE); | 526 EngineTestCase.assertSize3(5, superinterfacesOfE); |
| 482 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); | 527 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); |
| 483 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); | 528 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); |
| 484 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); | 529 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); |
| 485 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); | 530 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); |
| 486 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); | 531 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); |
| 487 } | 532 } |
| 533 |
| 488 void test_computeSuperinterfaceSet_recursion() { | 534 void test_computeSuperinterfaceSet_recursion() { |
| 489 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 535 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 490 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 536 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 491 classA.supertype = classB.type; | 537 classA.supertype = classB.type; |
| 492 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 538 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
| 493 EngineTestCase.assertSize3(2, superinterfacesOfB); | 539 EngineTestCase.assertSize3(2, superinterfacesOfB); |
| 494 } | 540 } |
| 541 |
| 495 void test_computeSuperinterfaceSet_singleInterfacePath() { | 542 void test_computeSuperinterfaceSet_singleInterfacePath() { |
| 496 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 543 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 497 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 544 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 498 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 545 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 499 classB.interfaces = <InterfaceType> [classA.type]; | 546 classB.interfaces = <InterfaceType> [classA.type]; |
| 500 classC.interfaces = <InterfaceType> [classB.type]; | 547 classC.interfaces = <InterfaceType> [classB.type]; |
| 501 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); | 548 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); |
| 502 EngineTestCase.assertSize3(1, superinterfacesOfA); | 549 EngineTestCase.assertSize3(1, superinterfacesOfA); |
| 503 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); | 550 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); |
| 504 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 551 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
| 505 EngineTestCase.assertSize3(2, superinterfacesOfB); | 552 EngineTestCase.assertSize3(2, superinterfacesOfB); |
| 506 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); | 553 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); |
| 507 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); | 554 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); |
| 508 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); | 555 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); |
| 509 EngineTestCase.assertSize3(3, superinterfacesOfC); | 556 EngineTestCase.assertSize3(3, superinterfacesOfC); |
| 510 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); | 557 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); |
| 511 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); | 558 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); |
| 512 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); | 559 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); |
| 513 } | 560 } |
| 561 |
| 514 void test_computeSuperinterfaceSet_singleSuperclassPath() { | 562 void test_computeSuperinterfaceSet_singleSuperclassPath() { |
| 515 ClassElement classA = ElementFactory.classElement2("A", []); | 563 ClassElement classA = ElementFactory.classElement2("A", []); |
| 516 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 564 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 517 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 565 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
| 518 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); | 566 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); |
| 519 EngineTestCase.assertSize3(1, superinterfacesOfA); | 567 EngineTestCase.assertSize3(1, superinterfacesOfA); |
| 520 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); | 568 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); |
| 521 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 569 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
| 522 EngineTestCase.assertSize3(2, superinterfacesOfB); | 570 EngineTestCase.assertSize3(2, superinterfacesOfB); |
| 523 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); | 571 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); |
| 524 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); | 572 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); |
| 525 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); | 573 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); |
| 526 EngineTestCase.assertSize3(3, superinterfacesOfC); | 574 EngineTestCase.assertSize3(3, superinterfacesOfC); |
| 527 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); | 575 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); |
| 528 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); | 576 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); |
| 529 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); | 577 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); |
| 530 } | 578 } |
| 579 |
| 531 void test_creation() { | 580 void test_creation() { |
| 532 JUnitTestCase.assertNotNull(new InterfaceTypeImpl.con1(ElementFactory.classE
lement2("A", []))); | 581 JUnitTestCase.assertNotNull(new InterfaceTypeImpl.con1(ElementFactory.classE
lement2("A", []))); |
| 533 } | 582 } |
| 583 |
| 534 void test_getAccessors() { | 584 void test_getAccessors() { |
| 535 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); | 585 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); |
| 536 PropertyAccessorElement getterG = ElementFactory.getterElement("g", false, n
ull); | 586 PropertyAccessorElement getterG = ElementFactory.getterElement("g", false, n
ull); |
| 537 PropertyAccessorElement getterH = ElementFactory.getterElement("h", false, n
ull); | 587 PropertyAccessorElement getterH = ElementFactory.getterElement("h", false, n
ull); |
| 538 typeElement.accessors = <PropertyAccessorElement> [getterG, getterH]; | 588 typeElement.accessors = <PropertyAccessorElement> [getterG, getterH]; |
| 539 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); | 589 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); |
| 540 JUnitTestCase.assertEquals(2, type.accessors.length); | 590 JUnitTestCase.assertEquals(2, type.accessors.length); |
| 541 } | 591 } |
| 592 |
| 542 void test_getAccessors_empty() { | 593 void test_getAccessors_empty() { |
| 543 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); | 594 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); |
| 544 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); | 595 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); |
| 545 JUnitTestCase.assertEquals(0, type.accessors.length); | 596 JUnitTestCase.assertEquals(0, type.accessors.length); |
| 546 } | 597 } |
| 598 |
| 547 void test_getElement() { | 599 void test_getElement() { |
| 548 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); | 600 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); |
| 549 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); | 601 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); |
| 550 JUnitTestCase.assertEquals(typeElement, type.element); | 602 JUnitTestCase.assertEquals(typeElement, type.element); |
| 551 } | 603 } |
| 604 |
| 552 void test_getGetter_implemented() { | 605 void test_getGetter_implemented() { |
| 553 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 606 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 554 String getterName = "g"; | 607 String getterName = "g"; |
| 555 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); | 608 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); |
| 556 classA.accessors = <PropertyAccessorElement> [getterG]; | 609 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 557 InterfaceType typeA = classA.type; | 610 InterfaceType typeA = classA.type; |
| 558 JUnitTestCase.assertSame(getterG, typeA.getGetter(getterName)); | 611 JUnitTestCase.assertSame(getterG, typeA.getGetter(getterName)); |
| 559 } | 612 } |
| 613 |
| 560 void test_getGetter_parameterized() { | 614 void test_getGetter_parameterized() { |
| 561 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 615 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 562 Type2 typeE = classA.type.typeArguments[0]; | 616 Type2 typeE = classA.type.typeArguments[0]; |
| 563 String getterName = "g"; | 617 String getterName = "g"; |
| 564 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, typeE); | 618 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, typeE); |
| 565 classA.accessors = <PropertyAccessorElement> [getterG]; | 619 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 566 ((getterG.type as FunctionTypeImpl)).typeArguments = classA.type.typeArgumen
ts; | 620 (getterG.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; |
| 567 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 621 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 568 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 622 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 569 typeAI.typeArguments = <Type2> [typeI]; | 623 typeAI.typeArguments = <Type2> [typeI]; |
| 570 PropertyAccessorElement getter = typeAI.getGetter(getterName); | 624 PropertyAccessorElement getter = typeAI.getGetter(getterName); |
| 571 JUnitTestCase.assertNotNull(getter); | 625 JUnitTestCase.assertNotNull(getter); |
| 572 FunctionType getterType = getter.type; | 626 FunctionType getterType = getter.type; |
| 573 JUnitTestCase.assertSame(typeI, getterType.returnType); | 627 JUnitTestCase.assertSame(typeI, getterType.returnType); |
| 574 } | 628 } |
| 629 |
| 575 void test_getGetter_unimplemented() { | 630 void test_getGetter_unimplemented() { |
| 576 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 631 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 577 InterfaceType typeA = classA.type; | 632 InterfaceType typeA = classA.type; |
| 578 JUnitTestCase.assertNull(typeA.getGetter("g")); | 633 JUnitTestCase.assertNull(typeA.getGetter("g")); |
| 579 } | 634 } |
| 635 |
| 580 void test_getInterfaces_nonParameterized() { | 636 void test_getInterfaces_nonParameterized() { |
| 581 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 637 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 582 InterfaceType typeA = classA.type; | 638 InterfaceType typeA = classA.type; |
| 583 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 639 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 584 InterfaceType typeB = classB.type; | 640 InterfaceType typeB = classB.type; |
| 585 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 641 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 586 classC.interfaces = <InterfaceType> [typeA, typeB]; | 642 classC.interfaces = <InterfaceType> [typeA, typeB]; |
| 587 List<InterfaceType> interfaces = classC.type.interfaces; | 643 List<InterfaceType> interfaces = classC.type.interfaces; |
| 588 EngineTestCase.assertLength(2, interfaces); | 644 EngineTestCase.assertLength(2, interfaces); |
| 589 if (identical(interfaces[0], typeA)) { | 645 if (identical(interfaces[0], typeA)) { |
| 590 JUnitTestCase.assertSame(typeB, interfaces[1]); | 646 JUnitTestCase.assertSame(typeB, interfaces[1]); |
| 591 } else { | 647 } else { |
| 592 JUnitTestCase.assertSame(typeB, interfaces[0]); | 648 JUnitTestCase.assertSame(typeB, interfaces[0]); |
| 593 JUnitTestCase.assertSame(typeA, interfaces[1]); | 649 JUnitTestCase.assertSame(typeA, interfaces[1]); |
| 594 } | 650 } |
| 595 } | 651 } |
| 652 |
| 596 void test_getInterfaces_parameterized() { | 653 void test_getInterfaces_parameterized() { |
| 597 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 654 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 598 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 655 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 599 InterfaceType typeB = classB.type; | 656 InterfaceType typeB = classB.type; |
| 600 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 657 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 601 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; | 658 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; |
| 602 classB.interfaces = <InterfaceType> [typeAF]; | 659 classB.interfaces = <InterfaceType> [typeAF]; |
| 603 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 660 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 604 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 661 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 605 typeBI.typeArguments = <Type2> [typeI]; | 662 typeBI.typeArguments = <Type2> [typeI]; |
| 606 List<InterfaceType> interfaces = typeBI.interfaces; | 663 List<InterfaceType> interfaces = typeBI.interfaces; |
| 607 EngineTestCase.assertLength(1, interfaces); | 664 EngineTestCase.assertLength(1, interfaces); |
| 608 InterfaceType result = interfaces[0]; | 665 InterfaceType result = interfaces[0]; |
| 609 JUnitTestCase.assertSame(classA, result.element); | 666 JUnitTestCase.assertSame(classA, result.element); |
| 610 JUnitTestCase.assertSame(typeI, result.typeArguments[0]); | 667 JUnitTestCase.assertSame(typeI, result.typeArguments[0]); |
| 611 } | 668 } |
| 669 |
| 612 void test_getLeastUpperBound_directInterfaceCase() { | 670 void test_getLeastUpperBound_directInterfaceCase() { |
| 613 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 671 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 614 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 672 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 615 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 673 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 616 InterfaceType typeA = classA.type; | 674 InterfaceType typeA = classA.type; |
| 617 InterfaceType typeB = classB.type; | 675 InterfaceType typeB = classB.type; |
| 618 InterfaceType typeC = classC.type; | 676 InterfaceType typeC = classC.type; |
| 619 classB.interfaces = <InterfaceType> [typeA]; | 677 classB.interfaces = <InterfaceType> [typeA]; |
| 620 classC.interfaces = <InterfaceType> [typeB]; | 678 classC.interfaces = <InterfaceType> [typeB]; |
| 621 JUnitTestCase.assertEquals(typeB, typeB.getLeastUpperBound(typeC)); | 679 JUnitTestCase.assertEquals(typeB, typeB.getLeastUpperBound(typeC)); |
| 622 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeB)); | 680 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeB)); |
| 623 } | 681 } |
| 682 |
| 624 void test_getLeastUpperBound_directSubclassCase() { | 683 void test_getLeastUpperBound_directSubclassCase() { |
| 625 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 684 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 626 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 685 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 627 ClassElementImpl classC = ElementFactory.classElement("C", classB.type, []); | 686 ClassElementImpl classC = ElementFactory.classElement("C", classB.type, []); |
| 628 InterfaceType typeB = classB.type; | 687 InterfaceType typeB = classB.type; |
| 629 InterfaceType typeC = classC.type; | 688 InterfaceType typeC = classC.type; |
| 630 JUnitTestCase.assertEquals(typeB, typeB.getLeastUpperBound(typeC)); | 689 JUnitTestCase.assertEquals(typeB, typeB.getLeastUpperBound(typeC)); |
| 631 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeB)); | 690 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeB)); |
| 632 } | 691 } |
| 692 |
| 633 void test_getLeastUpperBound_functionType() { | 693 void test_getLeastUpperBound_functionType() { |
| 634 Type2 interfaceType = ElementFactory.classElement2("A", []).type; | 694 Type2 interfaceType = ElementFactory.classElement2("A", []).type; |
| 635 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(new FunctionElemen
tImpl.con1(ASTFactory.identifier3("f"))); | 695 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(new FunctionElemen
tImpl.con1(ASTFactory.identifier3("f"))); |
| 636 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(functionType)); | 696 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(functionType)); |
| 637 } | 697 } |
| 698 |
| 638 void test_getLeastUpperBound_mixinCase() { | 699 void test_getLeastUpperBound_mixinCase() { |
| 639 ClassElement classA = ElementFactory.classElement2("A", []); | 700 ClassElement classA = ElementFactory.classElement2("A", []); |
| 640 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 701 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 641 ClassElement classC = ElementFactory.classElement("C", classA.type, []); | 702 ClassElement classC = ElementFactory.classElement("C", classA.type, []); |
| 642 ClassElementImpl classD = ElementFactory.classElement("D", classB.type, []); | 703 ClassElementImpl classD = ElementFactory.classElement("D", classB.type, []); |
| 643 InterfaceType typeA = classA.type; | 704 InterfaceType typeA = classA.type; |
| 644 InterfaceType typeC = classC.type; | 705 InterfaceType typeC = classC.type; |
| 645 InterfaceType typeD = classD.type; | 706 InterfaceType typeD = classD.type; |
| 646 classD.mixins = <InterfaceType> [ | 707 classD.mixins = <InterfaceType> [ |
| 647 ElementFactory.classElement2("M", []).type, | 708 ElementFactory.classElement2("M", []).type, |
| 648 ElementFactory.classElement2("N", []).type, | 709 ElementFactory.classElement2("N", []).type, |
| 649 ElementFactory.classElement2("O", []).type, | 710 ElementFactory.classElement2("O", []).type, |
| 650 ElementFactory.classElement2("P", []).type]; | 711 ElementFactory.classElement2("P", []).type]; |
| 651 JUnitTestCase.assertEquals(typeA, typeD.getLeastUpperBound(typeC)); | 712 JUnitTestCase.assertEquals(typeA, typeD.getLeastUpperBound(typeC)); |
| 652 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeD)); | 713 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeD)); |
| 653 } | 714 } |
| 715 |
| 654 void test_getLeastUpperBound_null() { | 716 void test_getLeastUpperBound_null() { |
| 655 Type2 interfaceType = ElementFactory.classElement2("A", []).type; | 717 Type2 interfaceType = ElementFactory.classElement2("A", []).type; |
| 656 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(null)); | 718 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(null)); |
| 657 } | 719 } |
| 720 |
| 658 void test_getLeastUpperBound_object() { | 721 void test_getLeastUpperBound_object() { |
| 659 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 722 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 660 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 723 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 661 InterfaceType typeA = classA.type; | 724 InterfaceType typeA = classA.type; |
| 662 InterfaceType typeB = classB.type; | 725 InterfaceType typeB = classB.type; |
| 663 Type2 typeObject = typeA.element.supertype; | 726 Type2 typeObject = typeA.element.supertype; |
| 664 JUnitTestCase.assertNull(((typeObject.element as ClassElement)).supertype); | 727 JUnitTestCase.assertNull((typeObject.element as ClassElement).supertype); |
| 665 JUnitTestCase.assertEquals(typeObject, typeB.element.supertype); | 728 JUnitTestCase.assertEquals(typeObject, typeB.element.supertype); |
| 666 JUnitTestCase.assertEquals(typeObject, typeA.getLeastUpperBound(typeB)); | 729 JUnitTestCase.assertEquals(typeObject, typeA.getLeastUpperBound(typeB)); |
| 667 } | 730 } |
| 731 |
| 668 void test_getLeastUpperBound_self() { | 732 void test_getLeastUpperBound_self() { |
| 669 ClassElement classA = ElementFactory.classElement2("A", []); | 733 ClassElement classA = ElementFactory.classElement2("A", []); |
| 670 InterfaceType typeA = classA.type; | 734 InterfaceType typeA = classA.type; |
| 671 JUnitTestCase.assertEquals(typeA, typeA.getLeastUpperBound(typeA)); | 735 JUnitTestCase.assertEquals(typeA, typeA.getLeastUpperBound(typeA)); |
| 672 } | 736 } |
| 737 |
| 673 void test_getLeastUpperBound_sharedSuperclass1() { | 738 void test_getLeastUpperBound_sharedSuperclass1() { |
| 674 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 739 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 675 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 740 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 676 ClassElementImpl classC = ElementFactory.classElement("C", classA.type, []); | 741 ClassElementImpl classC = ElementFactory.classElement("C", classA.type, []); |
| 677 InterfaceType typeA = classA.type; | 742 InterfaceType typeA = classA.type; |
| 678 InterfaceType typeB = classB.type; | 743 InterfaceType typeB = classB.type; |
| 679 InterfaceType typeC = classC.type; | 744 InterfaceType typeC = classC.type; |
| 680 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); | 745 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); |
| 681 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); | 746 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); |
| 682 } | 747 } |
| 748 |
| 683 void test_getLeastUpperBound_sharedSuperclass2() { | 749 void test_getLeastUpperBound_sharedSuperclass2() { |
| 684 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 750 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 685 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 751 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 686 ClassElementImpl classC = ElementFactory.classElement("C", classA.type, []); | 752 ClassElementImpl classC = ElementFactory.classElement("C", classA.type, []); |
| 687 ClassElementImpl classD = ElementFactory.classElement("D", classC.type, []); | 753 ClassElementImpl classD = ElementFactory.classElement("D", classC.type, []); |
| 688 InterfaceType typeA = classA.type; | 754 InterfaceType typeA = classA.type; |
| 689 InterfaceType typeB = classB.type; | 755 InterfaceType typeB = classB.type; |
| 690 InterfaceType typeD = classD.type; | 756 InterfaceType typeD = classD.type; |
| 691 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeD)); | 757 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeD)); |
| 692 JUnitTestCase.assertEquals(typeA, typeD.getLeastUpperBound(typeB)); | 758 JUnitTestCase.assertEquals(typeA, typeD.getLeastUpperBound(typeB)); |
| 693 } | 759 } |
| 760 |
| 694 void test_getLeastUpperBound_sharedSuperclass3() { | 761 void test_getLeastUpperBound_sharedSuperclass3() { |
| 695 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 762 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 696 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 763 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 697 ClassElementImpl classC = ElementFactory.classElement("C", classB.type, []); | 764 ClassElementImpl classC = ElementFactory.classElement("C", classB.type, []); |
| 698 ClassElementImpl classD = ElementFactory.classElement("D", classB.type, []); | 765 ClassElementImpl classD = ElementFactory.classElement("D", classB.type, []); |
| 699 InterfaceType typeB = classB.type; | 766 InterfaceType typeB = classB.type; |
| 700 InterfaceType typeC = classC.type; | 767 InterfaceType typeC = classC.type; |
| 701 InterfaceType typeD = classD.type; | 768 InterfaceType typeD = classD.type; |
| 702 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeD)); | 769 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeD)); |
| 703 JUnitTestCase.assertEquals(typeB, typeD.getLeastUpperBound(typeC)); | 770 JUnitTestCase.assertEquals(typeB, typeD.getLeastUpperBound(typeC)); |
| 704 } | 771 } |
| 772 |
| 705 void test_getLeastUpperBound_sharedSuperclass4() { | 773 void test_getLeastUpperBound_sharedSuperclass4() { |
| 706 ClassElement classA = ElementFactory.classElement2("A", []); | 774 ClassElement classA = ElementFactory.classElement2("A", []); |
| 707 ClassElement classA2 = ElementFactory.classElement2("A2", []); | 775 ClassElement classA2 = ElementFactory.classElement2("A2", []); |
| 708 ClassElement classA3 = ElementFactory.classElement2("A3", []); | 776 ClassElement classA3 = ElementFactory.classElement2("A3", []); |
| 709 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 777 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 710 ClassElementImpl classC = ElementFactory.classElement("C", classA.type, []); | 778 ClassElementImpl classC = ElementFactory.classElement("C", classA.type, []); |
| 711 InterfaceType typeA = classA.type; | 779 InterfaceType typeA = classA.type; |
| 712 InterfaceType typeA2 = classA2.type; | 780 InterfaceType typeA2 = classA2.type; |
| 713 InterfaceType typeA3 = classA3.type; | 781 InterfaceType typeA3 = classA3.type; |
| 714 InterfaceType typeB = classB.type; | 782 InterfaceType typeB = classB.type; |
| 715 InterfaceType typeC = classC.type; | 783 InterfaceType typeC = classC.type; |
| 716 classB.interfaces = <InterfaceType> [typeA2]; | 784 classB.interfaces = <InterfaceType> [typeA2]; |
| 717 classC.interfaces = <InterfaceType> [typeA3]; | 785 classC.interfaces = <InterfaceType> [typeA3]; |
| 718 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); | 786 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); |
| 719 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); | 787 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); |
| 720 } | 788 } |
| 789 |
| 721 void test_getLeastUpperBound_sharedSuperinterface1() { | 790 void test_getLeastUpperBound_sharedSuperinterface1() { |
| 722 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 791 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 723 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 792 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 724 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 793 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 725 InterfaceType typeA = classA.type; | 794 InterfaceType typeA = classA.type; |
| 726 InterfaceType typeB = classB.type; | 795 InterfaceType typeB = classB.type; |
| 727 InterfaceType typeC = classC.type; | 796 InterfaceType typeC = classC.type; |
| 728 classB.interfaces = <InterfaceType> [typeA]; | 797 classB.interfaces = <InterfaceType> [typeA]; |
| 729 classC.interfaces = <InterfaceType> [typeA]; | 798 classC.interfaces = <InterfaceType> [typeA]; |
| 730 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); | 799 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); |
| 731 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); | 800 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); |
| 732 } | 801 } |
| 802 |
| 733 void test_getLeastUpperBound_sharedSuperinterface2() { | 803 void test_getLeastUpperBound_sharedSuperinterface2() { |
| 734 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 804 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 735 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 805 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 736 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 806 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 737 ClassElementImpl classD = ElementFactory.classElement2("D", []); | 807 ClassElementImpl classD = ElementFactory.classElement2("D", []); |
| 738 InterfaceType typeA = classA.type; | 808 InterfaceType typeA = classA.type; |
| 739 InterfaceType typeB = classB.type; | 809 InterfaceType typeB = classB.type; |
| 740 InterfaceType typeC = classC.type; | 810 InterfaceType typeC = classC.type; |
| 741 InterfaceType typeD = classD.type; | 811 InterfaceType typeD = classD.type; |
| 742 classB.interfaces = <InterfaceType> [typeA]; | 812 classB.interfaces = <InterfaceType> [typeA]; |
| 743 classC.interfaces = <InterfaceType> [typeA]; | 813 classC.interfaces = <InterfaceType> [typeA]; |
| 744 classD.interfaces = <InterfaceType> [typeC]; | 814 classD.interfaces = <InterfaceType> [typeC]; |
| 745 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeD)); | 815 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeD)); |
| 746 JUnitTestCase.assertEquals(typeA, typeD.getLeastUpperBound(typeB)); | 816 JUnitTestCase.assertEquals(typeA, typeD.getLeastUpperBound(typeB)); |
| 747 } | 817 } |
| 818 |
| 748 void test_getLeastUpperBound_sharedSuperinterface3() { | 819 void test_getLeastUpperBound_sharedSuperinterface3() { |
| 749 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 820 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 750 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 821 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 751 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 822 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 752 ClassElementImpl classD = ElementFactory.classElement2("D", []); | 823 ClassElementImpl classD = ElementFactory.classElement2("D", []); |
| 753 InterfaceType typeA = classA.type; | 824 InterfaceType typeA = classA.type; |
| 754 InterfaceType typeB = classB.type; | 825 InterfaceType typeB = classB.type; |
| 755 InterfaceType typeC = classC.type; | 826 InterfaceType typeC = classC.type; |
| 756 InterfaceType typeD = classD.type; | 827 InterfaceType typeD = classD.type; |
| 757 classB.interfaces = <InterfaceType> [typeA]; | 828 classB.interfaces = <InterfaceType> [typeA]; |
| 758 classC.interfaces = <InterfaceType> [typeB]; | 829 classC.interfaces = <InterfaceType> [typeB]; |
| 759 classD.interfaces = <InterfaceType> [typeB]; | 830 classD.interfaces = <InterfaceType> [typeB]; |
| 760 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeD)); | 831 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeD)); |
| 761 JUnitTestCase.assertEquals(typeB, typeD.getLeastUpperBound(typeC)); | 832 JUnitTestCase.assertEquals(typeB, typeD.getLeastUpperBound(typeC)); |
| 762 } | 833 } |
| 834 |
| 763 void test_getLeastUpperBound_sharedSuperinterface4() { | 835 void test_getLeastUpperBound_sharedSuperinterface4() { |
| 764 ClassElement classA = ElementFactory.classElement2("A", []); | 836 ClassElement classA = ElementFactory.classElement2("A", []); |
| 765 ClassElement classA2 = ElementFactory.classElement2("A2", []); | 837 ClassElement classA2 = ElementFactory.classElement2("A2", []); |
| 766 ClassElement classA3 = ElementFactory.classElement2("A3", []); | 838 ClassElement classA3 = ElementFactory.classElement2("A3", []); |
| 767 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 839 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 768 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 840 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 769 InterfaceType typeA = classA.type; | 841 InterfaceType typeA = classA.type; |
| 770 InterfaceType typeA2 = classA2.type; | 842 InterfaceType typeA2 = classA2.type; |
| 771 InterfaceType typeA3 = classA3.type; | 843 InterfaceType typeA3 = classA3.type; |
| 772 InterfaceType typeB = classB.type; | 844 InterfaceType typeB = classB.type; |
| 773 InterfaceType typeC = classC.type; | 845 InterfaceType typeC = classC.type; |
| 774 classB.interfaces = <InterfaceType> [typeA, typeA2]; | 846 classB.interfaces = <InterfaceType> [typeA, typeA2]; |
| 775 classC.interfaces = <InterfaceType> [typeA, typeA3]; | 847 classC.interfaces = <InterfaceType> [typeA, typeA3]; |
| 776 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); | 848 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); |
| 777 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); | 849 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); |
| 778 } | 850 } |
| 851 |
| 779 void test_getLeastUpperBound_twoComparables() { | 852 void test_getLeastUpperBound_twoComparables() { |
| 780 InterfaceType string = _typeProvider.stringType; | 853 InterfaceType string = _typeProvider.stringType; |
| 781 InterfaceType num = _typeProvider.numType; | 854 InterfaceType num = _typeProvider.numType; |
| 782 JUnitTestCase.assertEquals(_typeProvider.objectType, string.getLeastUpperBou
nd(num)); | 855 JUnitTestCase.assertEquals(_typeProvider.objectType, string.getLeastUpperBou
nd(num)); |
| 783 } | 856 } |
| 857 |
| 784 void test_getLeastUpperBound_typeParameters_different() { | 858 void test_getLeastUpperBound_typeParameters_different() { |
| 785 InterfaceType listType = _typeProvider.listType; | 859 InterfaceType listType = _typeProvider.listType; |
| 786 InterfaceType intType = _typeProvider.intType; | 860 InterfaceType intType = _typeProvider.intType; |
| 787 InterfaceType doubleType = _typeProvider.doubleType; | 861 InterfaceType doubleType = _typeProvider.doubleType; |
| 788 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); | 862 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); |
| 789 InterfaceType listOfDoubleType = listType.substitute4(<Type2> [doubleType]); | 863 InterfaceType listOfDoubleType = listType.substitute4(<Type2> [doubleType]); |
| 790 JUnitTestCase.assertEquals(listType.substitute4(<Type2> [_typeProvider.dynam
icType]), listOfIntType.getLeastUpperBound(listOfDoubleType)); | 864 JUnitTestCase.assertEquals(listType.substitute4(<Type2> [_typeProvider.dynam
icType]), listOfIntType.getLeastUpperBound(listOfDoubleType)); |
| 791 } | 865 } |
| 866 |
| 792 void test_getLeastUpperBound_typeParameters_same() { | 867 void test_getLeastUpperBound_typeParameters_same() { |
| 793 InterfaceType listType = _typeProvider.listType; | 868 InterfaceType listType = _typeProvider.listType; |
| 794 InterfaceType intType = _typeProvider.intType; | 869 InterfaceType intType = _typeProvider.intType; |
| 795 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); | 870 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); |
| 796 JUnitTestCase.assertEquals(listOfIntType, listOfIntType.getLeastUpperBound(l
istOfIntType)); | 871 JUnitTestCase.assertEquals(listOfIntType, listOfIntType.getLeastUpperBound(l
istOfIntType)); |
| 797 } | 872 } |
| 873 |
| 798 void test_getMethod_implemented() { | 874 void test_getMethod_implemented() { |
| 799 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 875 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 800 String methodName = "m"; | 876 String methodName = "m"; |
| 801 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); | 877 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); |
| 802 classA.methods = <MethodElement> [methodM]; | 878 classA.methods = <MethodElement> [methodM]; |
| 803 InterfaceType typeA = classA.type; | 879 InterfaceType typeA = classA.type; |
| 804 JUnitTestCase.assertSame(methodM, typeA.getMethod(methodName)); | 880 JUnitTestCase.assertSame(methodM, typeA.getMethod(methodName)); |
| 805 } | 881 } |
| 882 |
| 806 void test_getMethod_parameterized() { | 883 void test_getMethod_parameterized() { |
| 807 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 884 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 808 Type2 typeE = classA.type.typeArguments[0]; | 885 Type2 typeE = classA.type.typeArguments[0]; |
| 809 String methodName = "m"; | 886 String methodName = "m"; |
| 810 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE,
[typeE]); | 887 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE,
[typeE]); |
| 811 classA.methods = <MethodElement> [methodM]; | 888 classA.methods = <MethodElement> [methodM]; |
| 812 ((methodM.type as FunctionTypeImpl)).typeArguments = classA.type.typeArgumen
ts; | 889 (methodM.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; |
| 813 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 890 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 814 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 891 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 815 typeAI.typeArguments = <Type2> [typeI]; | 892 typeAI.typeArguments = <Type2> [typeI]; |
| 816 MethodElement method = typeAI.getMethod(methodName); | 893 MethodElement method = typeAI.getMethod(methodName); |
| 817 JUnitTestCase.assertNotNull(method); | 894 JUnitTestCase.assertNotNull(method); |
| 818 FunctionType methodType = method.type; | 895 FunctionType methodType = method.type; |
| 819 JUnitTestCase.assertSame(typeI, methodType.returnType); | 896 JUnitTestCase.assertSame(typeI, methodType.returnType); |
| 820 List<Type2> parameterTypes = methodType.normalParameterTypes; | 897 List<Type2> parameterTypes = methodType.normalParameterTypes; |
| 821 EngineTestCase.assertLength(1, parameterTypes); | 898 EngineTestCase.assertLength(1, parameterTypes); |
| 822 JUnitTestCase.assertSame(typeI, parameterTypes[0]); | 899 JUnitTestCase.assertSame(typeI, parameterTypes[0]); |
| 823 } | 900 } |
| 901 |
| 824 void test_getMethod_unimplemented() { | 902 void test_getMethod_unimplemented() { |
| 825 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 903 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 826 InterfaceType typeA = classA.type; | 904 InterfaceType typeA = classA.type; |
| 827 JUnitTestCase.assertNull(typeA.getMethod("m")); | 905 JUnitTestCase.assertNull(typeA.getMethod("m")); |
| 828 } | 906 } |
| 907 |
| 829 void test_getMethods() { | 908 void test_getMethods() { |
| 830 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); | 909 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); |
| 831 MethodElementImpl methodOne = ElementFactory.methodElement("one", null, []); | 910 MethodElementImpl methodOne = ElementFactory.methodElement("one", null, []); |
| 832 MethodElementImpl methodTwo = ElementFactory.methodElement("two", null, []); | 911 MethodElementImpl methodTwo = ElementFactory.methodElement("two", null, []); |
| 833 typeElement.methods = <MethodElement> [methodOne, methodTwo]; | 912 typeElement.methods = <MethodElement> [methodOne, methodTwo]; |
| 834 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); | 913 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); |
| 835 JUnitTestCase.assertEquals(2, type.methods.length); | 914 JUnitTestCase.assertEquals(2, type.methods.length); |
| 836 } | 915 } |
| 916 |
| 837 void test_getMethods_empty() { | 917 void test_getMethods_empty() { |
| 838 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); | 918 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); |
| 839 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); | 919 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); |
| 840 JUnitTestCase.assertEquals(0, type.methods.length); | 920 JUnitTestCase.assertEquals(0, type.methods.length); |
| 841 } | 921 } |
| 922 |
| 842 void test_getMixins_nonParameterized() { | 923 void test_getMixins_nonParameterized() { |
| 843 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 924 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 844 InterfaceType typeA = classA.type; | 925 InterfaceType typeA = classA.type; |
| 845 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 926 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 846 InterfaceType typeB = classB.type; | 927 InterfaceType typeB = classB.type; |
| 847 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 928 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 848 classC.mixins = <InterfaceType> [typeA, typeB]; | 929 classC.mixins = <InterfaceType> [typeA, typeB]; |
| 849 List<InterfaceType> interfaces = classC.type.mixins; | 930 List<InterfaceType> interfaces = classC.type.mixins; |
| 850 EngineTestCase.assertLength(2, interfaces); | 931 EngineTestCase.assertLength(2, interfaces); |
| 851 if (identical(interfaces[0], typeA)) { | 932 if (identical(interfaces[0], typeA)) { |
| 852 JUnitTestCase.assertSame(typeB, interfaces[1]); | 933 JUnitTestCase.assertSame(typeB, interfaces[1]); |
| 853 } else { | 934 } else { |
| 854 JUnitTestCase.assertSame(typeB, interfaces[0]); | 935 JUnitTestCase.assertSame(typeB, interfaces[0]); |
| 855 JUnitTestCase.assertSame(typeA, interfaces[1]); | 936 JUnitTestCase.assertSame(typeA, interfaces[1]); |
| 856 } | 937 } |
| 857 } | 938 } |
| 939 |
| 858 void test_getMixins_parameterized() { | 940 void test_getMixins_parameterized() { |
| 859 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 941 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 860 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 942 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 861 InterfaceType typeB = classB.type; | 943 InterfaceType typeB = classB.type; |
| 862 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 944 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 863 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; | 945 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; |
| 864 classB.mixins = <InterfaceType> [typeAF]; | 946 classB.mixins = <InterfaceType> [typeAF]; |
| 865 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 947 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 866 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 948 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 867 typeBI.typeArguments = <Type2> [typeI]; | 949 typeBI.typeArguments = <Type2> [typeI]; |
| 868 List<InterfaceType> interfaces = typeBI.mixins; | 950 List<InterfaceType> interfaces = typeBI.mixins; |
| 869 EngineTestCase.assertLength(1, interfaces); | 951 EngineTestCase.assertLength(1, interfaces); |
| 870 InterfaceType result = interfaces[0]; | 952 InterfaceType result = interfaces[0]; |
| 871 JUnitTestCase.assertSame(classA, result.element); | 953 JUnitTestCase.assertSame(classA, result.element); |
| 872 JUnitTestCase.assertSame(typeI, result.typeArguments[0]); | 954 JUnitTestCase.assertSame(typeI, result.typeArguments[0]); |
| 873 } | 955 } |
| 956 |
| 874 void test_getSetter_implemented() { | 957 void test_getSetter_implemented() { |
| 875 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 958 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 876 String setterName = "s"; | 959 String setterName = "s"; |
| 877 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); | 960 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); |
| 878 classA.accessors = <PropertyAccessorElement> [setterS]; | 961 classA.accessors = <PropertyAccessorElement> [setterS]; |
| 879 InterfaceType typeA = classA.type; | 962 InterfaceType typeA = classA.type; |
| 880 JUnitTestCase.assertSame(setterS, typeA.getSetter(setterName)); | 963 JUnitTestCase.assertSame(setterS, typeA.getSetter(setterName)); |
| 881 } | 964 } |
| 965 |
| 882 void test_getSetter_parameterized() { | 966 void test_getSetter_parameterized() { |
| 883 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 967 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 884 Type2 typeE = classA.type.typeArguments[0]; | 968 Type2 typeE = classA.type.typeArguments[0]; |
| 885 String setterName = "s"; | 969 String setterName = "s"; |
| 886 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, typeE); | 970 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, typeE); |
| 887 classA.accessors = <PropertyAccessorElement> [setterS]; | 971 classA.accessors = <PropertyAccessorElement> [setterS]; |
| 888 ((setterS.type as FunctionTypeImpl)).typeArguments = classA.type.typeArgumen
ts; | 972 (setterS.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; |
| 889 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 973 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 890 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 974 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 891 typeAI.typeArguments = <Type2> [typeI]; | 975 typeAI.typeArguments = <Type2> [typeI]; |
| 892 PropertyAccessorElement setter = typeAI.getSetter(setterName); | 976 PropertyAccessorElement setter = typeAI.getSetter(setterName); |
| 893 JUnitTestCase.assertNotNull(setter); | 977 JUnitTestCase.assertNotNull(setter); |
| 894 FunctionType setterType = setter.type; | 978 FunctionType setterType = setter.type; |
| 895 List<Type2> parameterTypes = setterType.normalParameterTypes; | 979 List<Type2> parameterTypes = setterType.normalParameterTypes; |
| 896 EngineTestCase.assertLength(1, parameterTypes); | 980 EngineTestCase.assertLength(1, parameterTypes); |
| 897 JUnitTestCase.assertSame(typeI, parameterTypes[0]); | 981 JUnitTestCase.assertSame(typeI, parameterTypes[0]); |
| 898 } | 982 } |
| 983 |
| 899 void test_getSetter_unimplemented() { | 984 void test_getSetter_unimplemented() { |
| 900 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 985 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 901 InterfaceType typeA = classA.type; | 986 InterfaceType typeA = classA.type; |
| 902 JUnitTestCase.assertNull(typeA.getSetter("s")); | 987 JUnitTestCase.assertNull(typeA.getSetter("s")); |
| 903 } | 988 } |
| 989 |
| 904 void test_getSuperclass_nonParameterized() { | 990 void test_getSuperclass_nonParameterized() { |
| 905 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 991 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 906 InterfaceType typeA = classA.type; | 992 InterfaceType typeA = classA.type; |
| 907 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); | 993 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 908 InterfaceType typeB = classB.type; | 994 InterfaceType typeB = classB.type; |
| 909 JUnitTestCase.assertSame(typeA, typeB.superclass); | 995 JUnitTestCase.assertSame(typeA, typeB.superclass); |
| 910 } | 996 } |
| 997 |
| 911 void test_getSuperclass_parameterized() { | 998 void test_getSuperclass_parameterized() { |
| 912 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 999 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 913 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 1000 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 914 InterfaceType typeB = classB.type; | 1001 InterfaceType typeB = classB.type; |
| 915 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 1002 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 916 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; | 1003 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; |
| 917 classB.supertype = typeAF; | 1004 classB.supertype = typeAF; |
| 918 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 1005 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 919 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 1006 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 920 typeBI.typeArguments = <Type2> [typeI]; | 1007 typeBI.typeArguments = <Type2> [typeI]; |
| 921 InterfaceType superclass = typeBI.superclass; | 1008 InterfaceType superclass = typeBI.superclass; |
| 922 JUnitTestCase.assertSame(classA, superclass.element); | 1009 JUnitTestCase.assertSame(classA, superclass.element); |
| 923 JUnitTestCase.assertSame(typeI, superclass.typeArguments[0]); | 1010 JUnitTestCase.assertSame(typeI, superclass.typeArguments[0]); |
| 924 } | 1011 } |
| 1012 |
| 925 void test_getTypeArguments_empty() { | 1013 void test_getTypeArguments_empty() { |
| 926 InterfaceType type = ElementFactory.classElement2("A", []).type; | 1014 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 927 EngineTestCase.assertLength(0, type.typeArguments); | 1015 EngineTestCase.assertLength(0, type.typeArguments); |
| 928 } | 1016 } |
| 1017 |
| 929 void test_hashCode() { | 1018 void test_hashCode() { |
| 930 ClassElement classA = ElementFactory.classElement2("A", []); | 1019 ClassElement classA = ElementFactory.classElement2("A", []); |
| 931 InterfaceType typeA = classA.type; | 1020 InterfaceType typeA = classA.type; |
| 932 JUnitTestCase.assertFalse(0 == typeA.hashCode); | 1021 JUnitTestCase.assertFalse(0 == typeA.hashCode); |
| 933 } | 1022 } |
| 1023 |
| 934 void test_isDirectSupertypeOf_extends() { | 1024 void test_isDirectSupertypeOf_extends() { |
| 935 ClassElement classA = ElementFactory.classElement2("A", []); | 1025 ClassElement classA = ElementFactory.classElement2("A", []); |
| 936 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1026 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 937 InterfaceType typeA = classA.type; | 1027 InterfaceType typeA = classA.type; |
| 938 InterfaceType typeB = classB.type; | 1028 InterfaceType typeB = classB.type; |
| 939 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); | 1029 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); |
| 940 } | 1030 } |
| 1031 |
| 941 void test_isDirectSupertypeOf_false() { | 1032 void test_isDirectSupertypeOf_false() { |
| 942 ClassElement classA = ElementFactory.classElement2("A", []); | 1033 ClassElement classA = ElementFactory.classElement2("A", []); |
| 943 ClassElement classB = ElementFactory.classElement2("B", []); | 1034 ClassElement classB = ElementFactory.classElement2("B", []); |
| 944 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 1035 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
| 945 InterfaceType typeA = classA.type; | 1036 InterfaceType typeA = classA.type; |
| 946 InterfaceType typeC = classC.type; | 1037 InterfaceType typeC = classC.type; |
| 947 JUnitTestCase.assertFalse(typeA.isDirectSupertypeOf(typeC)); | 1038 JUnitTestCase.assertFalse(typeA.isDirectSupertypeOf(typeC)); |
| 948 } | 1039 } |
| 1040 |
| 949 void test_isDirectSupertypeOf_implements() { | 1041 void test_isDirectSupertypeOf_implements() { |
| 950 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1042 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 951 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 1043 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 952 InterfaceType typeA = classA.type; | 1044 InterfaceType typeA = classA.type; |
| 953 InterfaceType typeB = classB.type; | 1045 InterfaceType typeB = classB.type; |
| 954 classB.interfaces = <InterfaceType> [typeA]; | 1046 classB.interfaces = <InterfaceType> [typeA]; |
| 955 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); | 1047 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); |
| 956 } | 1048 } |
| 1049 |
| 957 void test_isDirectSupertypeOf_with() { | 1050 void test_isDirectSupertypeOf_with() { |
| 958 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1051 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 959 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 1052 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 960 InterfaceType typeA = classA.type; | 1053 InterfaceType typeA = classA.type; |
| 961 InterfaceType typeB = classB.type; | 1054 InterfaceType typeB = classB.type; |
| 962 classB.mixins = <InterfaceType> [typeA]; | 1055 classB.mixins = <InterfaceType> [typeA]; |
| 963 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); | 1056 JUnitTestCase.assertTrue(typeA.isDirectSupertypeOf(typeB)); |
| 964 } | 1057 } |
| 1058 |
| 965 void test_isMoreSpecificThan_bottom() { | 1059 void test_isMoreSpecificThan_bottom() { |
| 966 Type2 type = ElementFactory.classElement2("A", []).type; | 1060 Type2 type = ElementFactory.classElement2("A", []).type; |
| 967 JUnitTestCase.assertTrue(BottomTypeImpl.instance.isMoreSpecificThan(type)); | 1061 JUnitTestCase.assertTrue(BottomTypeImpl.instance.isMoreSpecificThan(type)); |
| 968 } | 1062 } |
| 1063 |
| 969 void test_isMoreSpecificThan_covariance() { | 1064 void test_isMoreSpecificThan_covariance() { |
| 970 ClassElement classA = ElementFactory.classElement2("A", ["E"]); | 1065 ClassElement classA = ElementFactory.classElement2("A", ["E"]); |
| 971 ClassElement classI = ElementFactory.classElement2("I", []); | 1066 ClassElement classI = ElementFactory.classElement2("I", []); |
| 972 ClassElement classJ = ElementFactory.classElement("J", classI.type, []); | 1067 ClassElement classJ = ElementFactory.classElement("J", classI.type, []); |
| 973 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 1068 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 974 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA); | 1069 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA); |
| 975 typeAI.typeArguments = <Type2> [classI.type]; | 1070 typeAI.typeArguments = <Type2> [classI.type]; |
| 976 typeAJ.typeArguments = <Type2> [classJ.type]; | 1071 typeAJ.typeArguments = <Type2> [classJ.type]; |
| 977 JUnitTestCase.assertTrue(typeAJ.isMoreSpecificThan(typeAI)); | 1072 JUnitTestCase.assertTrue(typeAJ.isMoreSpecificThan(typeAI)); |
| 978 JUnitTestCase.assertFalse(typeAI.isMoreSpecificThan(typeAJ)); | 1073 JUnitTestCase.assertFalse(typeAI.isMoreSpecificThan(typeAJ)); |
| 979 } | 1074 } |
| 1075 |
| 980 void test_isMoreSpecificThan_directSupertype() { | 1076 void test_isMoreSpecificThan_directSupertype() { |
| 981 ClassElement classA = ElementFactory.classElement2("A", []); | 1077 ClassElement classA = ElementFactory.classElement2("A", []); |
| 982 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1078 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 983 InterfaceType typeA = classA.type; | 1079 InterfaceType typeA = classA.type; |
| 984 InterfaceType typeB = classB.type; | 1080 InterfaceType typeB = classB.type; |
| 985 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA)); | 1081 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA)); |
| 986 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB)); | 1082 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB)); |
| 987 } | 1083 } |
| 1084 |
| 988 void test_isMoreSpecificThan_dynamic() { | 1085 void test_isMoreSpecificThan_dynamic() { |
| 989 InterfaceType type = ElementFactory.classElement2("A", []).type; | 1086 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 990 JUnitTestCase.assertTrue(type.isMoreSpecificThan(DynamicTypeImpl.instance)); | 1087 JUnitTestCase.assertTrue(type.isMoreSpecificThan(DynamicTypeImpl.instance)); |
| 991 } | 1088 } |
| 1089 |
| 992 void test_isMoreSpecificThan_self() { | 1090 void test_isMoreSpecificThan_self() { |
| 993 InterfaceType type = ElementFactory.classElement2("A", []).type; | 1091 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 994 JUnitTestCase.assertTrue(type.isMoreSpecificThan(type)); | 1092 JUnitTestCase.assertTrue(type.isMoreSpecificThan(type)); |
| 995 } | 1093 } |
| 1094 |
| 996 void test_isMoreSpecificThan_transitive_interface() { | 1095 void test_isMoreSpecificThan_transitive_interface() { |
| 997 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1096 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 998 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1097 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 999 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1098 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1000 classC.interfaces = <InterfaceType> [classB.type]; | 1099 classC.interfaces = <InterfaceType> [classB.type]; |
| 1001 InterfaceType typeA = classA.type; | 1100 InterfaceType typeA = classA.type; |
| 1002 InterfaceType typeC = classC.type; | 1101 InterfaceType typeC = classC.type; |
| 1003 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); | 1102 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); |
| 1004 } | 1103 } |
| 1104 |
| 1005 void test_isMoreSpecificThan_transitive_mixin() { | 1105 void test_isMoreSpecificThan_transitive_mixin() { |
| 1006 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1106 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1007 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1107 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1008 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1108 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1009 classC.mixins = <InterfaceType> [classB.type]; | 1109 classC.mixins = <InterfaceType> [classB.type]; |
| 1010 InterfaceType typeA = classA.type; | 1110 InterfaceType typeA = classA.type; |
| 1011 InterfaceType typeC = classC.type; | 1111 InterfaceType typeC = classC.type; |
| 1012 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); | 1112 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); |
| 1013 } | 1113 } |
| 1114 |
| 1014 void test_isMoreSpecificThan_transitive_recursive() { | 1115 void test_isMoreSpecificThan_transitive_recursive() { |
| 1015 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1116 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1016 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1117 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1017 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1118 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1018 InterfaceType typeA = classA.type; | 1119 InterfaceType typeA = classA.type; |
| 1019 InterfaceType typeC = classC.type; | 1120 InterfaceType typeC = classC.type; |
| 1020 classA.supertype = classB.type; | 1121 classA.supertype = classB.type; |
| 1021 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeC)); | 1122 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeC)); |
| 1022 } | 1123 } |
| 1124 |
| 1023 void test_isMoreSpecificThan_transitive_superclass() { | 1125 void test_isMoreSpecificThan_transitive_superclass() { |
| 1024 ClassElement classA = ElementFactory.classElement2("A", []); | 1126 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1025 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1127 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1026 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 1128 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
| 1027 InterfaceType typeA = classA.type; | 1129 InterfaceType typeA = classA.type; |
| 1028 InterfaceType typeC = classC.type; | 1130 InterfaceType typeC = classC.type; |
| 1029 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); | 1131 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); |
| 1030 } | 1132 } |
| 1133 |
| 1031 void test_isSubtypeOf_directSubtype() { | 1134 void test_isSubtypeOf_directSubtype() { |
| 1032 ClassElement classA = ElementFactory.classElement2("A", []); | 1135 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1033 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1136 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1034 InterfaceType typeA = classA.type; | 1137 InterfaceType typeA = classA.type; |
| 1035 InterfaceType typeB = classB.type; | 1138 InterfaceType typeB = classB.type; |
| 1036 JUnitTestCase.assertTrue(typeB.isSubtypeOf(typeA)); | 1139 JUnitTestCase.assertTrue(typeB.isSubtypeOf(typeA)); |
| 1037 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeB)); | 1140 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeB)); |
| 1038 } | 1141 } |
| 1142 |
| 1039 void test_isSubtypeOf_dynamic() { | 1143 void test_isSubtypeOf_dynamic() { |
| 1040 ClassElement classA = ElementFactory.classElement2("A", []); | 1144 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1041 InterfaceType typeA = classA.type; | 1145 InterfaceType typeA = classA.type; |
| 1042 Type2 dynamicType = DynamicTypeImpl.instance; | 1146 Type2 dynamicType = DynamicTypeImpl.instance; |
| 1043 JUnitTestCase.assertTrue(dynamicType.isSubtypeOf(typeA)); | 1147 JUnitTestCase.assertTrue(dynamicType.isSubtypeOf(typeA)); |
| 1044 JUnitTestCase.assertTrue(typeA.isSubtypeOf(dynamicType)); | 1148 JUnitTestCase.assertTrue(typeA.isSubtypeOf(dynamicType)); |
| 1045 } | 1149 } |
| 1150 |
| 1046 void test_isSubtypeOf_function() { | 1151 void test_isSubtypeOf_function() { |
| 1047 InterfaceType stringType = _typeProvider.stringType; | 1152 InterfaceType stringType = _typeProvider.stringType; |
| 1048 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1153 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1049 classA.methods = <MethodElement> [ElementFactory.methodElement("call", VoidT
ypeImpl.instance, [stringType])]; | 1154 classA.methods = <MethodElement> [ElementFactory.methodElement("call", VoidT
ypeImpl.instance, [stringType])]; |
| 1050 FunctionType functionType = ElementFactory.functionElement5("f", <ClassEleme
nt> [stringType.element]).type; | 1155 FunctionType functionType = ElementFactory.functionElement5("f", <ClassEleme
nt> [stringType.element]).type; |
| 1051 JUnitTestCase.assertTrue(classA.type.isSubtypeOf(functionType)); | 1156 JUnitTestCase.assertTrue(classA.type.isSubtypeOf(functionType)); |
| 1052 } | 1157 } |
| 1158 |
| 1053 void test_isSubtypeOf_interface() { | 1159 void test_isSubtypeOf_interface() { |
| 1054 ClassElement classA = ElementFactory.classElement2("A", []); | 1160 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1055 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1161 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1056 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1162 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1057 InterfaceType typeObject = classA.supertype; | 1163 InterfaceType typeObject = classA.supertype; |
| 1058 InterfaceType typeA = classA.type; | 1164 InterfaceType typeA = classA.type; |
| 1059 InterfaceType typeB = classB.type; | 1165 InterfaceType typeB = classB.type; |
| 1060 InterfaceType typeC = classC.type; | 1166 InterfaceType typeC = classC.type; |
| 1061 classC.interfaces = <InterfaceType> [typeB]; | 1167 classC.interfaces = <InterfaceType> [typeB]; |
| 1062 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); | 1168 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); |
| 1063 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); | 1169 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); |
| 1064 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); | 1170 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); |
| 1065 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); | 1171 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); |
| 1066 } | 1172 } |
| 1173 |
| 1067 void test_isSubtypeOf_mixins() { | 1174 void test_isSubtypeOf_mixins() { |
| 1068 ClassElement classA = ElementFactory.classElement2("A", []); | 1175 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1069 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1176 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1070 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1177 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1071 InterfaceType typeObject = classA.supertype; | 1178 InterfaceType typeObject = classA.supertype; |
| 1072 InterfaceType typeA = classA.type; | 1179 InterfaceType typeA = classA.type; |
| 1073 InterfaceType typeB = classB.type; | 1180 InterfaceType typeB = classB.type; |
| 1074 InterfaceType typeC = classC.type; | 1181 InterfaceType typeC = classC.type; |
| 1075 classC.mixins = <InterfaceType> [typeB]; | 1182 classC.mixins = <InterfaceType> [typeB]; |
| 1076 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); | 1183 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); |
| 1077 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); | 1184 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); |
| 1078 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); | 1185 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); |
| 1079 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); | 1186 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); |
| 1080 } | 1187 } |
| 1188 |
| 1081 void test_isSubtypeOf_object() { | 1189 void test_isSubtypeOf_object() { |
| 1082 ClassElement classA = ElementFactory.classElement2("A", []); | 1190 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1083 InterfaceType typeA = classA.type; | 1191 InterfaceType typeA = classA.type; |
| 1084 InterfaceType typeObject = classA.supertype; | 1192 InterfaceType typeObject = classA.supertype; |
| 1085 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeObject)); | 1193 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeObject)); |
| 1086 JUnitTestCase.assertFalse(typeObject.isSubtypeOf(typeA)); | 1194 JUnitTestCase.assertFalse(typeObject.isSubtypeOf(typeA)); |
| 1087 } | 1195 } |
| 1196 |
| 1088 void test_isSubtypeOf_self() { | 1197 void test_isSubtypeOf_self() { |
| 1089 ClassElement classA = ElementFactory.classElement2("A", []); | 1198 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1090 InterfaceType typeA = classA.type; | 1199 InterfaceType typeA = classA.type; |
| 1091 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeA)); | 1200 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeA)); |
| 1092 } | 1201 } |
| 1202 |
| 1093 void test_isSubtypeOf_transitive_recursive() { | 1203 void test_isSubtypeOf_transitive_recursive() { |
| 1094 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1204 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1095 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1205 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1096 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1206 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1097 InterfaceType typeA = classA.type; | 1207 InterfaceType typeA = classA.type; |
| 1098 InterfaceType typeC = classC.type; | 1208 InterfaceType typeC = classC.type; |
| 1099 classA.supertype = classB.type; | 1209 classA.supertype = classB.type; |
| 1100 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); | 1210 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); |
| 1101 } | 1211 } |
| 1212 |
| 1102 void test_isSubtypeOf_transitive_superclass() { | 1213 void test_isSubtypeOf_transitive_superclass() { |
| 1103 ClassElement classA = ElementFactory.classElement2("A", []); | 1214 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1104 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1215 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1105 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 1216 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
| 1106 InterfaceType typeA = classA.type; | 1217 InterfaceType typeA = classA.type; |
| 1107 InterfaceType typeC = classC.type; | 1218 InterfaceType typeC = classC.type; |
| 1108 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); | 1219 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); |
| 1109 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); | 1220 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); |
| 1110 } | 1221 } |
| 1222 |
| 1111 void test_isSubtypeOf_typeArguments() { | 1223 void test_isSubtypeOf_typeArguments() { |
| 1112 Type2 dynamicType = DynamicTypeImpl.instance; | 1224 Type2 dynamicType = DynamicTypeImpl.instance; |
| 1113 ClassElement classA = ElementFactory.classElement2("A", ["E"]); | 1225 ClassElement classA = ElementFactory.classElement2("A", ["E"]); |
| 1114 ClassElement classI = ElementFactory.classElement2("I", []); | 1226 ClassElement classI = ElementFactory.classElement2("I", []); |
| 1115 ClassElement classJ = ElementFactory.classElement("J", classI.type, []); | 1227 ClassElement classJ = ElementFactory.classElement("J", classI.type, []); |
| 1116 ClassElement classK = ElementFactory.classElement2("K", []); | 1228 ClassElement classK = ElementFactory.classElement2("K", []); |
| 1117 InterfaceType typeA = classA.type; | 1229 InterfaceType typeA = classA.type; |
| 1118 InterfaceType typeA_dynamic = typeA.substitute4(<Type2> [dynamicType]); | 1230 InterfaceType typeA_dynamic = typeA.substitute4(<Type2> [dynamicType]); |
| 1119 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 1231 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 1120 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA); | 1232 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA); |
| 1121 InterfaceTypeImpl typeAK = new InterfaceTypeImpl.con1(classA); | 1233 InterfaceTypeImpl typeAK = new InterfaceTypeImpl.con1(classA); |
| 1122 typeAI.typeArguments = <Type2> [classI.type]; | 1234 typeAI.typeArguments = <Type2> [classI.type]; |
| 1123 typeAJ.typeArguments = <Type2> [classJ.type]; | 1235 typeAJ.typeArguments = <Type2> [classJ.type]; |
| 1124 typeAK.typeArguments = <Type2> [classK.type]; | 1236 typeAK.typeArguments = <Type2> [classK.type]; |
| 1125 JUnitTestCase.assertTrue(typeAJ.isSubtypeOf(typeAI)); | 1237 JUnitTestCase.assertTrue(typeAJ.isSubtypeOf(typeAI)); |
| 1126 JUnitTestCase.assertFalse(typeAI.isSubtypeOf(typeAJ)); | 1238 JUnitTestCase.assertFalse(typeAI.isSubtypeOf(typeAJ)); |
| 1127 JUnitTestCase.assertTrue(typeAI.isSubtypeOf(typeAI)); | 1239 JUnitTestCase.assertTrue(typeAI.isSubtypeOf(typeAI)); |
| 1128 JUnitTestCase.assertTrue(typeA_dynamic.isSubtypeOf(typeAI)); | 1240 JUnitTestCase.assertTrue(typeA_dynamic.isSubtypeOf(typeAI)); |
| 1129 JUnitTestCase.assertTrue(typeA_dynamic.isSubtypeOf(typeAJ)); | 1241 JUnitTestCase.assertTrue(typeA_dynamic.isSubtypeOf(typeAJ)); |
| 1130 JUnitTestCase.assertTrue(typeAI.isSubtypeOf(typeA_dynamic)); | 1242 JUnitTestCase.assertTrue(typeAI.isSubtypeOf(typeA_dynamic)); |
| 1131 JUnitTestCase.assertTrue(typeAJ.isSubtypeOf(typeA_dynamic)); | 1243 JUnitTestCase.assertTrue(typeAJ.isSubtypeOf(typeA_dynamic)); |
| 1132 JUnitTestCase.assertFalse(typeAI.isSubtypeOf(typeAK)); | 1244 JUnitTestCase.assertFalse(typeAI.isSubtypeOf(typeAK)); |
| 1133 JUnitTestCase.assertFalse(typeAK.isSubtypeOf(typeAI)); | 1245 JUnitTestCase.assertFalse(typeAK.isSubtypeOf(typeAI)); |
| 1134 } | 1246 } |
| 1247 |
| 1135 void test_isSupertypeOf_directSupertype() { | 1248 void test_isSupertypeOf_directSupertype() { |
| 1136 ClassElement classA = ElementFactory.classElement2("A", []); | 1249 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1137 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1250 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1138 InterfaceType typeA = classA.type; | 1251 InterfaceType typeA = classA.type; |
| 1139 InterfaceType typeB = classB.type; | 1252 InterfaceType typeB = classB.type; |
| 1140 JUnitTestCase.assertFalse(typeB.isSupertypeOf(typeA)); | 1253 JUnitTestCase.assertFalse(typeB.isSupertypeOf(typeA)); |
| 1141 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeB)); | 1254 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeB)); |
| 1142 } | 1255 } |
| 1256 |
| 1143 void test_isSupertypeOf_dynamic() { | 1257 void test_isSupertypeOf_dynamic() { |
| 1144 ClassElement classA = ElementFactory.classElement2("A", []); | 1258 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1145 InterfaceType typeA = classA.type; | 1259 InterfaceType typeA = classA.type; |
| 1146 Type2 dynamicType = DynamicTypeImpl.instance; | 1260 Type2 dynamicType = DynamicTypeImpl.instance; |
| 1147 JUnitTestCase.assertTrue(dynamicType.isSupertypeOf(typeA)); | 1261 JUnitTestCase.assertTrue(dynamicType.isSupertypeOf(typeA)); |
| 1148 JUnitTestCase.assertTrue(typeA.isSupertypeOf(dynamicType)); | 1262 JUnitTestCase.assertTrue(typeA.isSupertypeOf(dynamicType)); |
| 1149 } | 1263 } |
| 1264 |
| 1150 void test_isSupertypeOf_indirectSupertype() { | 1265 void test_isSupertypeOf_indirectSupertype() { |
| 1151 ClassElement classA = ElementFactory.classElement2("A", []); | 1266 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1152 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1267 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1153 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 1268 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
| 1154 InterfaceType typeA = classA.type; | 1269 InterfaceType typeA = classA.type; |
| 1155 InterfaceType typeC = classC.type; | 1270 InterfaceType typeC = classC.type; |
| 1156 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); | 1271 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); |
| 1157 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeC)); | 1272 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeC)); |
| 1158 } | 1273 } |
| 1274 |
| 1159 void test_isSupertypeOf_interface() { | 1275 void test_isSupertypeOf_interface() { |
| 1160 ClassElement classA = ElementFactory.classElement2("A", []); | 1276 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1161 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1277 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1162 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1278 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1163 InterfaceType typeObject = classA.supertype; | 1279 InterfaceType typeObject = classA.supertype; |
| 1164 InterfaceType typeA = classA.type; | 1280 InterfaceType typeA = classA.type; |
| 1165 InterfaceType typeB = classB.type; | 1281 InterfaceType typeB = classB.type; |
| 1166 InterfaceType typeC = classC.type; | 1282 InterfaceType typeC = classC.type; |
| 1167 classC.interfaces = <InterfaceType> [typeB]; | 1283 classC.interfaces = <InterfaceType> [typeB]; |
| 1168 JUnitTestCase.assertTrue(typeB.isSupertypeOf(typeC)); | 1284 JUnitTestCase.assertTrue(typeB.isSupertypeOf(typeC)); |
| 1169 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeC)); | 1285 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeC)); |
| 1170 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeC)); | 1286 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeC)); |
| 1171 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); | 1287 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); |
| 1172 } | 1288 } |
| 1289 |
| 1173 void test_isSupertypeOf_mixins() { | 1290 void test_isSupertypeOf_mixins() { |
| 1174 ClassElement classA = ElementFactory.classElement2("A", []); | 1291 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1175 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1292 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1176 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1293 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1177 InterfaceType typeObject = classA.supertype; | 1294 InterfaceType typeObject = classA.supertype; |
| 1178 InterfaceType typeA = classA.type; | 1295 InterfaceType typeA = classA.type; |
| 1179 InterfaceType typeB = classB.type; | 1296 InterfaceType typeB = classB.type; |
| 1180 InterfaceType typeC = classC.type; | 1297 InterfaceType typeC = classC.type; |
| 1181 classC.mixins = <InterfaceType> [typeB]; | 1298 classC.mixins = <InterfaceType> [typeB]; |
| 1182 JUnitTestCase.assertTrue(typeB.isSupertypeOf(typeC)); | 1299 JUnitTestCase.assertTrue(typeB.isSupertypeOf(typeC)); |
| 1183 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeC)); | 1300 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeC)); |
| 1184 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeC)); | 1301 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeC)); |
| 1185 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); | 1302 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); |
| 1186 } | 1303 } |
| 1304 |
| 1187 void test_isSupertypeOf_object() { | 1305 void test_isSupertypeOf_object() { |
| 1188 ClassElement classA = ElementFactory.classElement2("A", []); | 1306 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1189 InterfaceType typeA = classA.type; | 1307 InterfaceType typeA = classA.type; |
| 1190 InterfaceType typeObject = classA.supertype; | 1308 InterfaceType typeObject = classA.supertype; |
| 1191 JUnitTestCase.assertFalse(typeA.isSupertypeOf(typeObject)); | 1309 JUnitTestCase.assertFalse(typeA.isSupertypeOf(typeObject)); |
| 1192 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeA)); | 1310 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeA)); |
| 1193 } | 1311 } |
| 1312 |
| 1194 void test_isSupertypeOf_self() { | 1313 void test_isSupertypeOf_self() { |
| 1195 ClassElement classA = ElementFactory.classElement2("A", []); | 1314 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1196 InterfaceType typeA = classA.type; | 1315 InterfaceType typeA = classA.type; |
| 1197 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeA)); | 1316 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeA)); |
| 1198 } | 1317 } |
| 1318 |
| 1199 void test_lookUpGetter_implemented() { | 1319 void test_lookUpGetter_implemented() { |
| 1200 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1320 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1201 String getterName = "g"; | 1321 String getterName = "g"; |
| 1202 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); | 1322 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); |
| 1203 classA.accessors = <PropertyAccessorElement> [getterG]; | 1323 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 1204 InterfaceType typeA = classA.type; | 1324 InterfaceType typeA = classA.type; |
| 1205 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1325 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1206 CompilationUnitElement unit = library.definingCompilationUnit; | 1326 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1207 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1327 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1208 JUnitTestCase.assertSame(getterG, typeA.lookUpGetter(getterName, library)); | 1328 JUnitTestCase.assertSame(getterG, typeA.lookUpGetter(getterName, library)); |
| 1209 } | 1329 } |
| 1330 |
| 1210 void test_lookUpGetter_inherited() { | 1331 void test_lookUpGetter_inherited() { |
| 1211 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1332 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1212 String getterName = "g"; | 1333 String getterName = "g"; |
| 1213 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); | 1334 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); |
| 1214 classA.accessors = <PropertyAccessorElement> [getterG]; | 1335 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 1215 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1336 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1216 InterfaceType typeB = classB.type; | 1337 InterfaceType typeB = classB.type; |
| 1217 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1338 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1218 CompilationUnitElement unit = library.definingCompilationUnit; | 1339 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1219 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 1340 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1220 JUnitTestCase.assertSame(getterG, typeB.lookUpGetter(getterName, library)); | 1341 JUnitTestCase.assertSame(getterG, typeB.lookUpGetter(getterName, library)); |
| 1221 } | 1342 } |
| 1343 |
| 1222 void test_lookUpGetter_recursive() { | 1344 void test_lookUpGetter_recursive() { |
| 1223 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1345 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1224 InterfaceType typeA = classA.type; | 1346 InterfaceType typeA = classA.type; |
| 1225 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); | 1347 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 1226 classA.supertype = classB.type; | 1348 classA.supertype = classB.type; |
| 1227 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1349 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1228 CompilationUnitElement unit = library.definingCompilationUnit; | 1350 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1229 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 1351 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1230 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library)); | 1352 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library)); |
| 1231 } | 1353 } |
| 1354 |
| 1232 void test_lookUpGetter_unimplemented() { | 1355 void test_lookUpGetter_unimplemented() { |
| 1233 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1356 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1234 InterfaceType typeA = classA.type; | 1357 InterfaceType typeA = classA.type; |
| 1235 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1358 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1236 CompilationUnitElement unit = library.definingCompilationUnit; | 1359 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1237 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1360 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1238 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library)); | 1361 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library)); |
| 1239 } | 1362 } |
| 1363 |
| 1240 void test_lookUpMethod_implemented() { | 1364 void test_lookUpMethod_implemented() { |
| 1241 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1365 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1242 String methodName = "m"; | 1366 String methodName = "m"; |
| 1243 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); | 1367 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); |
| 1244 classA.methods = <MethodElement> [methodM]; | 1368 classA.methods = <MethodElement> [methodM]; |
| 1245 InterfaceType typeA = classA.type; | 1369 InterfaceType typeA = classA.type; |
| 1246 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1370 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1247 CompilationUnitElement unit = library.definingCompilationUnit; | 1371 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1248 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1372 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1249 JUnitTestCase.assertSame(methodM, typeA.lookUpMethod(methodName, library)); | 1373 JUnitTestCase.assertSame(methodM, typeA.lookUpMethod(methodName, library)); |
| 1250 } | 1374 } |
| 1375 |
| 1251 void test_lookUpMethod_inherited() { | 1376 void test_lookUpMethod_inherited() { |
| 1252 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1377 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1253 String methodName = "m"; | 1378 String methodName = "m"; |
| 1254 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); | 1379 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); |
| 1255 classA.methods = <MethodElement> [methodM]; | 1380 classA.methods = <MethodElement> [methodM]; |
| 1256 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1381 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1257 InterfaceType typeB = classB.type; | 1382 InterfaceType typeB = classB.type; |
| 1258 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1383 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1259 CompilationUnitElement unit = library.definingCompilationUnit; | 1384 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1260 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 1385 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1261 JUnitTestCase.assertSame(methodM, typeB.lookUpMethod(methodName, library)); | 1386 JUnitTestCase.assertSame(methodM, typeB.lookUpMethod(methodName, library)); |
| 1262 } | 1387 } |
| 1388 |
| 1263 void test_lookUpMethod_parameterized() { | 1389 void test_lookUpMethod_parameterized() { |
| 1264 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 1390 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 1265 Type2 typeE = classA.type.typeArguments[0]; | 1391 Type2 typeE = classA.type.typeArguments[0]; |
| 1266 String methodName = "m"; | 1392 String methodName = "m"; |
| 1267 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE,
[typeE]); | 1393 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE,
[typeE]); |
| 1268 classA.methods = <MethodElement> [methodM]; | 1394 classA.methods = <MethodElement> [methodM]; |
| 1269 ((methodM.type as FunctionTypeImpl)).typeArguments = classA.type.typeArgumen
ts; | 1395 (methodM.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; |
| 1270 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 1396 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 1271 InterfaceType typeB = classB.type; | 1397 InterfaceType typeB = classB.type; |
| 1272 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 1398 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 1273 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; | 1399 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; |
| 1274 classB.supertype = typeAF; | 1400 classB.supertype = typeAF; |
| 1275 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1401 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1276 CompilationUnitElement unit = library.definingCompilationUnit; | 1402 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1277 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1403 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1278 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 1404 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 1279 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 1405 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 1280 typeBI.typeArguments = <Type2> [typeI]; | 1406 typeBI.typeArguments = <Type2> [typeI]; |
| 1281 MethodElement method = typeBI.lookUpMethod(methodName, library); | 1407 MethodElement method = typeBI.lookUpMethod(methodName, library); |
| 1282 JUnitTestCase.assertNotNull(method); | 1408 JUnitTestCase.assertNotNull(method); |
| 1283 FunctionType methodType = method.type; | 1409 FunctionType methodType = method.type; |
| 1284 JUnitTestCase.assertSame(typeI, methodType.returnType); | 1410 JUnitTestCase.assertSame(typeI, methodType.returnType); |
| 1285 List<Type2> parameterTypes = methodType.normalParameterTypes; | 1411 List<Type2> parameterTypes = methodType.normalParameterTypes; |
| 1286 EngineTestCase.assertLength(1, parameterTypes); | 1412 EngineTestCase.assertLength(1, parameterTypes); |
| 1287 JUnitTestCase.assertSame(typeI, parameterTypes[0]); | 1413 JUnitTestCase.assertSame(typeI, parameterTypes[0]); |
| 1288 } | 1414 } |
| 1415 |
| 1289 void test_lookUpMethod_recursive() { | 1416 void test_lookUpMethod_recursive() { |
| 1290 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1417 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1291 InterfaceType typeA = classA.type; | 1418 InterfaceType typeA = classA.type; |
| 1292 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); | 1419 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 1293 classA.supertype = classB.type; | 1420 classA.supertype = classB.type; |
| 1294 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1421 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1295 CompilationUnitElement unit = library.definingCompilationUnit; | 1422 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1296 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 1423 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1297 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library)); | 1424 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library)); |
| 1298 } | 1425 } |
| 1426 |
| 1299 void test_lookUpMethod_unimplemented() { | 1427 void test_lookUpMethod_unimplemented() { |
| 1300 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1428 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1301 InterfaceType typeA = classA.type; | 1429 InterfaceType typeA = classA.type; |
| 1302 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1430 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1303 CompilationUnitElement unit = library.definingCompilationUnit; | 1431 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1304 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1432 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1305 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library)); | 1433 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library)); |
| 1306 } | 1434 } |
| 1435 |
| 1307 void test_lookUpSetter_implemented() { | 1436 void test_lookUpSetter_implemented() { |
| 1308 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1437 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1309 String setterName = "s"; | 1438 String setterName = "s"; |
| 1310 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); | 1439 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); |
| 1311 classA.accessors = <PropertyAccessorElement> [setterS]; | 1440 classA.accessors = <PropertyAccessorElement> [setterS]; |
| 1312 InterfaceType typeA = classA.type; | 1441 InterfaceType typeA = classA.type; |
| 1313 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1442 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1314 CompilationUnitElement unit = library.definingCompilationUnit; | 1443 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1315 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1444 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1316 JUnitTestCase.assertSame(setterS, typeA.lookUpSetter(setterName, library)); | 1445 JUnitTestCase.assertSame(setterS, typeA.lookUpSetter(setterName, library)); |
| 1317 } | 1446 } |
| 1447 |
| 1318 void test_lookUpSetter_inherited() { | 1448 void test_lookUpSetter_inherited() { |
| 1319 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1449 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1320 String setterName = "g"; | 1450 String setterName = "g"; |
| 1321 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); | 1451 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); |
| 1322 classA.accessors = <PropertyAccessorElement> [setterS]; | 1452 classA.accessors = <PropertyAccessorElement> [setterS]; |
| 1323 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1453 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1324 InterfaceType typeB = classB.type; | 1454 InterfaceType typeB = classB.type; |
| 1325 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1455 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1326 CompilationUnitElement unit = library.definingCompilationUnit; | 1456 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1327 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 1457 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1328 JUnitTestCase.assertSame(setterS, typeB.lookUpSetter(setterName, library)); | 1458 JUnitTestCase.assertSame(setterS, typeB.lookUpSetter(setterName, library)); |
| 1329 } | 1459 } |
| 1460 |
| 1330 void test_lookUpSetter_recursive() { | 1461 void test_lookUpSetter_recursive() { |
| 1331 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1462 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1332 InterfaceType typeA = classA.type; | 1463 InterfaceType typeA = classA.type; |
| 1333 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); | 1464 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 1334 classA.supertype = classB.type; | 1465 classA.supertype = classB.type; |
| 1335 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1466 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1336 CompilationUnitElement unit = library.definingCompilationUnit; | 1467 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1337 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 1468 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1338 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); | 1469 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); |
| 1339 } | 1470 } |
| 1471 |
| 1340 void test_lookUpSetter_unimplemented() { | 1472 void test_lookUpSetter_unimplemented() { |
| 1341 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1473 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1342 InterfaceType typeA = classA.type; | 1474 InterfaceType typeA = classA.type; |
| 1343 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1475 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1344 CompilationUnitElement unit = library.definingCompilationUnit; | 1476 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1345 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1477 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1346 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); | 1478 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); |
| 1347 } | 1479 } |
| 1480 |
| 1348 void test_setTypeArguments() { | 1481 void test_setTypeArguments() { |
| 1349 InterfaceTypeImpl type = ElementFactory.classElement2("A", []).type as Inter
faceTypeImpl; | 1482 InterfaceTypeImpl type = ElementFactory.classElement2("A", []).type as Inter
faceTypeImpl; |
| 1350 List<Type2> typeArguments = <Type2> [ | 1483 List<Type2> typeArguments = <Type2> [ |
| 1351 ElementFactory.classElement2("B", []).type, | 1484 ElementFactory.classElement2("B", []).type, |
| 1352 ElementFactory.classElement2("C", []).type]; | 1485 ElementFactory.classElement2("C", []).type]; |
| 1353 type.typeArguments = typeArguments; | 1486 type.typeArguments = typeArguments; |
| 1354 JUnitTestCase.assertEquals(typeArguments, type.typeArguments); | 1487 JUnitTestCase.assertEquals(typeArguments, type.typeArguments); |
| 1355 } | 1488 } |
| 1489 |
| 1356 void test_substitute_equal() { | 1490 void test_substitute_equal() { |
| 1357 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1491 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1358 TypeParameterElementImpl parameterElement = new TypeParameterElementImpl(AST
Factory.identifier3("E")); | 1492 TypeParameterElementImpl parameterElement = new TypeParameterElementImpl(AST
Factory.identifier3("E")); |
| 1359 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); | 1493 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); |
| 1360 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(parameterElement
); | 1494 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(parameterElement
); |
| 1361 type.typeArguments = <Type2> [parameter]; | 1495 type.typeArguments = <Type2> [parameter]; |
| 1362 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; | 1496 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; |
| 1363 InterfaceType result = type.substitute2(<Type2> [argumentType], <Type2> [par
ameter]); | 1497 InterfaceType result = type.substitute2(<Type2> [argumentType], <Type2> [par
ameter]); |
| 1364 JUnitTestCase.assertEquals(classA, result.element); | 1498 JUnitTestCase.assertEquals(classA, result.element); |
| 1365 List<Type2> resultArguments = result.typeArguments; | 1499 List<Type2> resultArguments = result.typeArguments; |
| 1366 EngineTestCase.assertLength(1, resultArguments); | 1500 EngineTestCase.assertLength(1, resultArguments); |
| 1367 JUnitTestCase.assertEquals(argumentType, resultArguments[0]); | 1501 JUnitTestCase.assertEquals(argumentType, resultArguments[0]); |
| 1368 } | 1502 } |
| 1503 |
| 1369 void test_substitute_exception() { | 1504 void test_substitute_exception() { |
| 1370 try { | 1505 try { |
| 1371 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1506 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1372 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); | 1507 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); |
| 1373 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; | 1508 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; |
| 1374 type.substitute2(<Type2> [argumentType], <Type2> []); | 1509 type.substitute2(<Type2> [argumentType], <Type2> []); |
| 1375 JUnitTestCase.fail("Expected to encounter exception, argument and paramete
r type array lengths not equal."); | 1510 JUnitTestCase.fail("Expected to encounter exception, argument and paramete
r type array lengths not equal."); |
| 1376 } on JavaException catch (e) { | 1511 } on JavaException catch (e) { |
| 1377 } | 1512 } |
| 1378 } | 1513 } |
| 1514 |
| 1379 void test_substitute_notEqual() { | 1515 void test_substitute_notEqual() { |
| 1380 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1516 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1381 TypeParameterElementImpl parameterElement = new TypeParameterElementImpl(AST
Factory.identifier3("E")); | 1517 TypeParameterElementImpl parameterElement = new TypeParameterElementImpl(AST
Factory.identifier3("E")); |
| 1382 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); | 1518 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); |
| 1383 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(parameterElement
); | 1519 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(parameterElement
); |
| 1384 type.typeArguments = <Type2> [parameter]; | 1520 type.typeArguments = <Type2> [parameter]; |
| 1385 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; | 1521 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; |
| 1386 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(new TypePara
meterElementImpl(ASTFactory.identifier3("F"))); | 1522 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(new TypePara
meterElementImpl(ASTFactory.identifier3("F"))); |
| 1387 InterfaceType result = type.substitute2(<Type2> [argumentType], <Type2> [par
ameterType]); | 1523 InterfaceType result = type.substitute2(<Type2> [argumentType], <Type2> [par
ameterType]); |
| 1388 JUnitTestCase.assertEquals(classA, result.element); | 1524 JUnitTestCase.assertEquals(classA, result.element); |
| 1389 List<Type2> resultArguments = result.typeArguments; | 1525 List<Type2> resultArguments = result.typeArguments; |
| 1390 EngineTestCase.assertLength(1, resultArguments); | 1526 EngineTestCase.assertLength(1, resultArguments); |
| 1391 JUnitTestCase.assertEquals(parameter, resultArguments[0]); | 1527 JUnitTestCase.assertEquals(parameter, resultArguments[0]); |
| 1392 } | 1528 } |
| 1529 |
| 1393 static dartSuite() { | 1530 static dartSuite() { |
| 1394 _ut.group('InterfaceTypeImplTest', () { | 1531 _ut.group('InterfaceTypeImplTest', () { |
| 1395 _ut.test('test_computeLongestInheritancePathToObject_multipleInterfacePath
s', () { | 1532 _ut.test('test_computeLongestInheritancePathToObject_multipleInterfacePath
s', () { |
| 1396 final __test = new InterfaceTypeImplTest(); | 1533 final __test = new InterfaceTypeImplTest(); |
| 1397 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_m
ultipleInterfacePaths); | 1534 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_m
ultipleInterfacePaths); |
| 1398 }); | 1535 }); |
| 1399 _ut.test('test_computeLongestInheritancePathToObject_multipleSuperclassPat
hs', () { | 1536 _ut.test('test_computeLongestInheritancePathToObject_multipleSuperclassPat
hs', () { |
| 1400 final __test = new InterfaceTypeImplTest(); | 1537 final __test = new InterfaceTypeImplTest(); |
| 1401 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_m
ultipleSuperclassPaths); | 1538 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_m
ultipleSuperclassPaths); |
| 1402 }); | 1539 }); |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1784 final __test = new InterfaceTypeImplTest(); | 1921 final __test = new InterfaceTypeImplTest(); |
| 1785 runJUnitTest(__test, __test.test_substitute_exception); | 1922 runJUnitTest(__test, __test.test_substitute_exception); |
| 1786 }); | 1923 }); |
| 1787 _ut.test('test_substitute_notEqual', () { | 1924 _ut.test('test_substitute_notEqual', () { |
| 1788 final __test = new InterfaceTypeImplTest(); | 1925 final __test = new InterfaceTypeImplTest(); |
| 1789 runJUnitTest(__test, __test.test_substitute_notEqual); | 1926 runJUnitTest(__test, __test.test_substitute_notEqual); |
| 1790 }); | 1927 }); |
| 1791 }); | 1928 }); |
| 1792 } | 1929 } |
| 1793 } | 1930 } |
| 1931 |
| 1932 class VoidTypeImplTest extends EngineTestCase { |
| 1933 /** |
| 1934 * Reference {code VoidTypeImpl.getInstance()}. |
| 1935 */ |
| 1936 Type2 _voidType = VoidTypeImpl.instance; |
| 1937 |
| 1938 void test_isMoreSpecificThan_void_A() { |
| 1939 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1940 JUnitTestCase.assertFalse(_voidType.isMoreSpecificThan(classA.type)); |
| 1941 } |
| 1942 |
| 1943 void test_isMoreSpecificThan_void_dynamic() { |
| 1944 JUnitTestCase.assertTrue(_voidType.isMoreSpecificThan(DynamicTypeImpl.instan
ce)); |
| 1945 } |
| 1946 |
| 1947 void test_isMoreSpecificThan_void_void() { |
| 1948 JUnitTestCase.assertTrue(_voidType.isMoreSpecificThan(_voidType)); |
| 1949 } |
| 1950 |
| 1951 void test_isSubtypeOf_void_A() { |
| 1952 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1953 JUnitTestCase.assertFalse(_voidType.isSubtypeOf(classA.type)); |
| 1954 } |
| 1955 |
| 1956 void test_isSubtypeOf_void_dynamic() { |
| 1957 JUnitTestCase.assertTrue(_voidType.isSubtypeOf(DynamicTypeImpl.instance)); |
| 1958 } |
| 1959 |
| 1960 void test_isSubtypeOf_void_void() { |
| 1961 JUnitTestCase.assertTrue(_voidType.isSubtypeOf(_voidType)); |
| 1962 } |
| 1963 |
| 1964 void test_isVoid() { |
| 1965 JUnitTestCase.assertTrue(_voidType.isVoid); |
| 1966 } |
| 1967 |
| 1968 static dartSuite() { |
| 1969 _ut.group('VoidTypeImplTest', () { |
| 1970 _ut.test('test_isMoreSpecificThan_void_A', () { |
| 1971 final __test = new VoidTypeImplTest(); |
| 1972 runJUnitTest(__test, __test.test_isMoreSpecificThan_void_A); |
| 1973 }); |
| 1974 _ut.test('test_isMoreSpecificThan_void_dynamic', () { |
| 1975 final __test = new VoidTypeImplTest(); |
| 1976 runJUnitTest(__test, __test.test_isMoreSpecificThan_void_dynamic); |
| 1977 }); |
| 1978 _ut.test('test_isMoreSpecificThan_void_void', () { |
| 1979 final __test = new VoidTypeImplTest(); |
| 1980 runJUnitTest(__test, __test.test_isMoreSpecificThan_void_void); |
| 1981 }); |
| 1982 _ut.test('test_isSubtypeOf_void_A', () { |
| 1983 final __test = new VoidTypeImplTest(); |
| 1984 runJUnitTest(__test, __test.test_isSubtypeOf_void_A); |
| 1985 }); |
| 1986 _ut.test('test_isSubtypeOf_void_dynamic', () { |
| 1987 final __test = new VoidTypeImplTest(); |
| 1988 runJUnitTest(__test, __test.test_isSubtypeOf_void_dynamic); |
| 1989 }); |
| 1990 _ut.test('test_isSubtypeOf_void_void', () { |
| 1991 final __test = new VoidTypeImplTest(); |
| 1992 runJUnitTest(__test, __test.test_isSubtypeOf_void_void); |
| 1993 }); |
| 1994 _ut.test('test_isVoid', () { |
| 1995 final __test = new VoidTypeImplTest(); |
| 1996 runJUnitTest(__test, __test.test_isVoid); |
| 1997 }); |
| 1998 }); |
| 1999 } |
| 2000 } |
| 2001 |
| 1794 /** | 2002 /** |
| 1795 * The class `ElementFactory` defines utility methods used to create elements fo
r testing | 2003 * The class `ElementFactory` defines utility methods used to create elements fo
r testing |
| 1796 * purposes. The elements that are created are complete in the sense that as muc
h of the element | 2004 * purposes. The elements that are created are complete in the sense that as muc
h of the element |
| 1797 * model as can be created, given the provided information, has been created. | 2005 * model as can be created, given the provided information, has been created. |
| 1798 */ | 2006 */ |
| 1799 class ElementFactory { | 2007 class ElementFactory { |
| 1800 | |
| 1801 /** | 2008 /** |
| 1802 * The element representing the class 'Object'. | 2009 * The element representing the class 'Object'. |
| 1803 */ | 2010 */ |
| 1804 static ClassElementImpl _objectElement; | 2011 static ClassElementImpl _objectElement; |
| 2012 |
| 1805 static ClassElementImpl classElement(String typeName, InterfaceType superclass
Type, List<String> parameterNames) { | 2013 static ClassElementImpl classElement(String typeName, InterfaceType superclass
Type, List<String> parameterNames) { |
| 1806 ClassElementImpl element = new ClassElementImpl(ASTFactory.identifier3(typeN
ame)); | 2014 ClassElementImpl element = new ClassElementImpl(ASTFactory.identifier3(typeN
ame)); |
| 1807 element.supertype = superclassType; | 2015 element.supertype = superclassType; |
| 1808 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(element); | 2016 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(element); |
| 1809 element.type = type; | 2017 element.type = type; |
| 1810 int count = parameterNames.length; | 2018 int count = parameterNames.length; |
| 1811 if (count > 0) { | 2019 if (count > 0) { |
| 1812 List<TypeParameterElementImpl> typeParameters = new List<TypeParameterElem
entImpl>(count); | 2020 List<TypeParameterElementImpl> typeParameters = new List<TypeParameterElem
entImpl>(count); |
| 1813 List<TypeParameterTypeImpl> typeParameterTypes = new List<TypeParameterTyp
eImpl>(count); | 2021 List<TypeParameterTypeImpl> typeParameterTypes = new List<TypeParameterTyp
eImpl>(count); |
| 1814 for (int i = 0; i < count; i++) { | 2022 for (int i = 0; i < count; i++) { |
| 1815 TypeParameterElementImpl typeParameter = new TypeParameterElementImpl(AS
TFactory.identifier3(parameterNames[i])); | 2023 TypeParameterElementImpl typeParameter = new TypeParameterElementImpl(AS
TFactory.identifier3(parameterNames[i])); |
| 1816 typeParameters[i] = typeParameter; | 2024 typeParameters[i] = typeParameter; |
| 1817 typeParameterTypes[i] = new TypeParameterTypeImpl(typeParameter); | 2025 typeParameterTypes[i] = new TypeParameterTypeImpl(typeParameter); |
| 1818 typeParameter.type = typeParameterTypes[i]; | 2026 typeParameter.type = typeParameterTypes[i]; |
| 1819 } | 2027 } |
| 1820 element.typeParameters = typeParameters; | 2028 element.typeParameters = typeParameters; |
| 1821 type.typeArguments = typeParameterTypes; | 2029 type.typeArguments = typeParameterTypes; |
| 1822 } | 2030 } |
| 1823 return element; | 2031 return element; |
| 1824 } | 2032 } |
| 2033 |
| 1825 static ClassElementImpl classElement2(String typeName, List<String> parameterN
ames) => classElement(typeName, object.type, parameterNames); | 2034 static ClassElementImpl classElement2(String typeName, List<String> parameterN
ames) => classElement(typeName, object.type, parameterNames); |
| 1826 static ConstructorElementImpl constructorElement(ClassElement definingClass, S
tring name) { | 2035 |
| 2036 static ConstructorElementImpl constructorElement(ClassElement definingClass, S
tring name, bool isConst, List<Type2> argumentTypes) { |
| 1827 Type2 type = definingClass.type; | 2037 Type2 type = definingClass.type; |
| 1828 ConstructorElementImpl constructor = new ConstructorElementImpl(name == null
? null : ASTFactory.identifier3(name)); | 2038 ConstructorElementImpl constructor = new ConstructorElementImpl(name == null
? null : ASTFactory.identifier3(name)); |
| 2039 constructor.const2 = isConst; |
| 2040 int count = argumentTypes.length; |
| 2041 List<ParameterElement> parameters = new List<ParameterElement>(count); |
| 2042 for (int i = 0; i < count; i++) { |
| 2043 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.
identifier3("a${i}")); |
| 2044 parameter.type = argumentTypes[i]; |
| 2045 parameter.parameterKind = ParameterKind.REQUIRED; |
| 2046 parameters[i] = parameter; |
| 2047 } |
| 2048 constructor.parameters = parameters; |
| 1829 constructor.returnType = type; | 2049 constructor.returnType = type; |
| 1830 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); | 2050 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); |
| 1831 constructor.type = constructorType; | 2051 constructor.type = constructorType; |
| 1832 return constructor; | 2052 return constructor; |
| 1833 } | 2053 } |
| 2054 |
| 2055 static ConstructorElementImpl constructorElement2(ClassElement definingClass,
String name, List<Type2> argumentTypes) => constructorElement(definingClass, nam
e, false, argumentTypes); |
| 2056 |
| 1834 static ExportElementImpl exportFor(LibraryElement exportedLibrary, List<Namesp
aceCombinator> combinators) { | 2057 static ExportElementImpl exportFor(LibraryElement exportedLibrary, List<Namesp
aceCombinator> combinators) { |
| 1835 ExportElementImpl spec = new ExportElementImpl(); | 2058 ExportElementImpl spec = new ExportElementImpl(); |
| 1836 spec.exportedLibrary = exportedLibrary; | 2059 spec.exportedLibrary = exportedLibrary; |
| 1837 spec.combinators = combinators; | 2060 spec.combinators = combinators; |
| 1838 return spec; | 2061 return spec; |
| 1839 } | 2062 } |
| 2063 |
| 1840 static FieldElementImpl fieldElement(String name, bool isStatic, bool isFinal,
bool isConst, Type2 type) { | 2064 static FieldElementImpl fieldElement(String name, bool isStatic, bool isFinal,
bool isConst, Type2 type) { |
| 1841 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); | 2065 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); |
| 1842 field.const3 = isConst; | 2066 field.const3 = isConst; |
| 1843 field.final2 = isFinal; | 2067 field.final2 = isFinal; |
| 1844 field.static = isStatic; | 2068 field.static = isStatic; |
| 1845 field.type = type; | 2069 field.type = type; |
| 1846 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); | 2070 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); |
| 1847 getter.getter = true; | 2071 getter.getter = true; |
| 1848 getter.static = isStatic; | 2072 getter.static = isStatic; |
| 1849 getter.synthetic = true; | 2073 getter.synthetic = true; |
| 1850 getter.variable = field; | 2074 getter.variable = field; |
| 1851 getter.returnType = type; | 2075 getter.returnType = type; |
| 1852 field.getter = getter; | 2076 field.getter = getter; |
| 1853 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); | 2077 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); |
| 1854 getter.type = getterType; | 2078 getter.type = getterType; |
| 1855 if (!isConst && !isFinal) { | 2079 if (!isConst && !isFinal) { |
| 1856 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(
field); | 2080 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(
field); |
| 1857 setter.setter = true; | 2081 setter.setter = true; |
| 1858 setter.static = isStatic; | 2082 setter.static = isStatic; |
| 1859 setter.synthetic = true; | 2083 setter.synthetic = true; |
| 1860 setter.variable = field; | 2084 setter.variable = field; |
| 1861 setter.parameters = <ParameterElement> [requiredParameter2("_${name}", typ
e)]; | 2085 setter.parameters = <ParameterElement> [requiredParameter2("_${name}", typ
e)]; |
| 1862 setter.returnType = VoidTypeImpl.instance; | 2086 setter.returnType = VoidTypeImpl.instance; |
| 1863 setter.type = new FunctionTypeImpl.con1(setter); | 2087 setter.type = new FunctionTypeImpl.con1(setter); |
| 1864 field.setter = setter; | 2088 field.setter = setter; |
| 1865 } | 2089 } |
| 1866 return field; | 2090 return field; |
| 1867 } | 2091 } |
| 2092 |
| 1868 static FieldFormalParameterElementImpl fieldFormalParameter(Identifier name) =
> new FieldFormalParameterElementImpl(name); | 2093 static FieldFormalParameterElementImpl fieldFormalParameter(Identifier name) =
> new FieldFormalParameterElementImpl(name); |
| 2094 |
| 1869 static FunctionElementImpl functionElement(String functionName) => functionEle
ment4(functionName, null, null, null, null); | 2095 static FunctionElementImpl functionElement(String functionName) => functionEle
ment4(functionName, null, null, null, null); |
| 2096 |
| 1870 static FunctionElementImpl functionElement2(String functionName, ClassElement
returnElement) => functionElement3(functionName, returnElement, null, null); | 2097 static FunctionElementImpl functionElement2(String functionName, ClassElement
returnElement) => functionElement3(functionName, returnElement, null, null); |
| 2098 |
| 1871 static FunctionElementImpl functionElement3(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<ClassElement> optionalP
arameters) { | 2099 static FunctionElementImpl functionElement3(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<ClassElement> optionalP
arameters) { |
| 1872 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); | 2100 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); |
| 1873 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 2101 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 1874 functionElement.type = functionType; | 2102 functionElement.type = functionType; |
| 1875 if (returnElement == null) { | 2103 if (returnElement == null) { |
| 1876 functionElement.returnType = VoidTypeImpl.instance; | 2104 functionElement.returnType = VoidTypeImpl.instance; |
| 1877 } else { | 2105 } else { |
| 1878 functionElement.returnType = returnElement.type; | 2106 functionElement.returnType = returnElement.type; |
| 1879 } | 2107 } |
| 1880 int normalCount = normalParameters == null ? 0 : normalParameters.length; | 2108 int normalCount = normalParameters == null ? 0 : normalParameters.length; |
| 1881 int optionalCount = optionalParameters == null ? 0 : optionalParameters.leng
th; | 2109 int optionalCount = optionalParameters == null ? 0 : optionalParameters.leng
th; |
| 1882 int totalCount = normalCount + optionalCount; | 2110 int totalCount = normalCount + optionalCount; |
| 1883 List<ParameterElement> parameters = new List<ParameterElement>(totalCount); | 2111 List<ParameterElement> parameters = new List<ParameterElement>(totalCount); |
| 1884 for (int i = 0; i < totalCount; i++) { | 2112 for (int i = 0; i < totalCount; i++) { |
| 1885 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.
identifier3("a${i}")); | 2113 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.
identifier3("a${i}")); |
| 1886 if (i < normalCount) { | 2114 if (i < normalCount) { |
| 1887 parameter.type = normalParameters[i].type; | 2115 parameter.type = normalParameters[i].type; |
| 1888 parameter.parameterKind = ParameterKind.REQUIRED; | 2116 parameter.parameterKind = ParameterKind.REQUIRED; |
| 1889 } else { | 2117 } else { |
| 1890 parameter.type = optionalParameters[i - normalCount].type; | 2118 parameter.type = optionalParameters[i - normalCount].type; |
| 1891 parameter.parameterKind = ParameterKind.POSITIONAL; | 2119 parameter.parameterKind = ParameterKind.POSITIONAL; |
| 1892 } | 2120 } |
| 1893 parameters[i] = parameter; | 2121 parameters[i] = parameter; |
| 1894 } | 2122 } |
| 1895 functionElement.parameters = parameters; | 2123 functionElement.parameters = parameters; |
| 1896 return functionElement; | 2124 return functionElement; |
| 1897 } | 2125 } |
| 2126 |
| 1898 static FunctionElementImpl functionElement4(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<String> names, List<Cla
ssElement> namedParameters) { | 2127 static FunctionElementImpl functionElement4(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<String> names, List<Cla
ssElement> namedParameters) { |
| 1899 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); | 2128 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); |
| 1900 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 2129 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 1901 functionElement.type = functionType; | 2130 functionElement.type = functionType; |
| 1902 int normalCount = normalParameters == null ? 0 : normalParameters.length; | 2131 int normalCount = normalParameters == null ? 0 : normalParameters.length; |
| 1903 int nameCount = names == null ? 0 : names.length; | 2132 int nameCount = names == null ? 0 : names.length; |
| 1904 int typeCount = namedParameters == null ? 0 : namedParameters.length; | 2133 int typeCount = namedParameters == null ? 0 : namedParameters.length; |
| 1905 if (names != null && nameCount != typeCount) { | 2134 if (names != null && nameCount != typeCount) { |
| 1906 throw new IllegalStateException("The passed String[] and ClassElement[] ar
rays had different lengths."); | 2135 throw new IllegalStateException("The passed String[] and ClassElement[] ar
rays had different lengths."); |
| 1907 } | 2136 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1921 } | 2150 } |
| 1922 } | 2151 } |
| 1923 functionElement.parameters = parameters; | 2152 functionElement.parameters = parameters; |
| 1924 if (returnElement == null) { | 2153 if (returnElement == null) { |
| 1925 functionElement.returnType = VoidTypeImpl.instance; | 2154 functionElement.returnType = VoidTypeImpl.instance; |
| 1926 } else { | 2155 } else { |
| 1927 functionElement.returnType = returnElement.type; | 2156 functionElement.returnType = returnElement.type; |
| 1928 } | 2157 } |
| 1929 return functionElement; | 2158 return functionElement; |
| 1930 } | 2159 } |
| 2160 |
| 1931 static FunctionElementImpl functionElement5(String functionName, List<ClassEle
ment> normalParameters) => functionElement3(functionName, null, normalParameters
, null); | 2161 static FunctionElementImpl functionElement5(String functionName, List<ClassEle
ment> normalParameters) => functionElement3(functionName, null, normalParameters
, null); |
| 2162 |
| 1932 static FunctionElementImpl functionElement6(String functionName, List<ClassEle
ment> normalParameters, List<ClassElement> optionalParameters) => functionElemen
t3(functionName, null, normalParameters, optionalParameters); | 2163 static FunctionElementImpl functionElement6(String functionName, List<ClassEle
ment> normalParameters, List<ClassElement> optionalParameters) => functionElemen
t3(functionName, null, normalParameters, optionalParameters); |
| 2164 |
| 1933 static FunctionElementImpl functionElement7(String functionName, List<ClassEle
ment> normalParameters, List<String> names, List<ClassElement> namedParameters)
=> functionElement4(functionName, null, normalParameters, names, namedParameters
); | 2165 static FunctionElementImpl functionElement7(String functionName, List<ClassEle
ment> normalParameters, List<String> names, List<ClassElement> namedParameters)
=> functionElement4(functionName, null, normalParameters, names, namedParameters
); |
| 2166 |
| 1934 static ClassElementImpl get object { | 2167 static ClassElementImpl get object { |
| 1935 if (_objectElement == null) { | 2168 if (_objectElement == null) { |
| 1936 _objectElement = classElement("Object", null as InterfaceType, []); | 2169 _objectElement = classElement("Object", null as InterfaceType, []); |
| 1937 } | 2170 } |
| 1938 return _objectElement; | 2171 return _objectElement; |
| 1939 } | 2172 } |
| 2173 |
| 1940 static PropertyAccessorElementImpl getterElement(String name, bool isStatic, T
ype2 type) { | 2174 static PropertyAccessorElementImpl getterElement(String name, bool isStatic, T
ype2 type) { |
| 1941 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); | 2175 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); |
| 1942 field.static = isStatic; | 2176 field.static = isStatic; |
| 1943 field.synthetic = true; | 2177 field.synthetic = true; |
| 1944 field.type = type; | 2178 field.type = type; |
| 1945 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); | 2179 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); |
| 1946 getter.getter = true; | 2180 getter.getter = true; |
| 1947 getter.static = isStatic; | 2181 getter.static = isStatic; |
| 1948 getter.variable = field; | 2182 getter.variable = field; |
| 1949 getter.returnType = type; | 2183 getter.returnType = type; |
| 1950 field.getter = getter; | 2184 field.getter = getter; |
| 1951 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); | 2185 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); |
| 1952 getter.type = getterType; | 2186 getter.type = getterType; |
| 1953 return getter; | 2187 return getter; |
| 1954 } | 2188 } |
| 2189 |
| 1955 static ImportElementImpl importFor(LibraryElement importedLibrary, PrefixEleme
nt prefix, List<NamespaceCombinator> combinators) { | 2190 static ImportElementImpl importFor(LibraryElement importedLibrary, PrefixEleme
nt prefix, List<NamespaceCombinator> combinators) { |
| 1956 ImportElementImpl spec = new ImportElementImpl(); | 2191 ImportElementImpl spec = new ImportElementImpl(); |
| 1957 spec.importedLibrary = importedLibrary; | 2192 spec.importedLibrary = importedLibrary; |
| 1958 spec.prefix = prefix; | 2193 spec.prefix = prefix; |
| 1959 spec.combinators = combinators; | 2194 spec.combinators = combinators; |
| 1960 return spec; | 2195 return spec; |
| 1961 } | 2196 } |
| 2197 |
| 1962 static LibraryElementImpl library(AnalysisContext context, String libraryName)
{ | 2198 static LibraryElementImpl library(AnalysisContext context, String libraryName)
{ |
| 1963 String fileName = "/${libraryName}.dart"; | 2199 String fileName = "/${libraryName}.dart"; |
| 1964 FileBasedSource source = new FileBasedSource.con1(context.sourceFactory.cont
entCache, FileUtilities2.createFile(fileName)); | 2200 FileBasedSource source = new FileBasedSource.con1(context.sourceFactory.cont
entCache, FileUtilities2.createFile(fileName)); |
| 1965 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName); | 2201 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName); |
| 1966 unit.source = source; | 2202 unit.source = source; |
| 1967 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2([libraryName])); | 2203 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2([libraryName])); |
| 1968 library.definingCompilationUnit = unit; | 2204 library.definingCompilationUnit = unit; |
| 1969 return library; | 2205 return library; |
| 1970 } | 2206 } |
| 2207 |
| 1971 static LocalVariableElementImpl localVariableElement(Identifier name) => new L
ocalVariableElementImpl(name); | 2208 static LocalVariableElementImpl localVariableElement(Identifier name) => new L
ocalVariableElementImpl(name); |
| 2209 |
| 1972 static LocalVariableElementImpl localVariableElement2(String name) => new Loca
lVariableElementImpl(ASTFactory.identifier3(name)); | 2210 static LocalVariableElementImpl localVariableElement2(String name) => new Loca
lVariableElementImpl(ASTFactory.identifier3(name)); |
| 2211 |
| 1973 static MethodElementImpl methodElement(String methodName, Type2 returnType, Li
st<Type2> argumentTypes) { | 2212 static MethodElementImpl methodElement(String methodName, Type2 returnType, Li
st<Type2> argumentTypes) { |
| 1974 MethodElementImpl method = new MethodElementImpl.con1(ASTFactory.identifier3
(methodName)); | 2213 MethodElementImpl method = new MethodElementImpl.con1(ASTFactory.identifier3
(methodName)); |
| 1975 int count = argumentTypes.length; | 2214 int count = argumentTypes.length; |
| 1976 List<ParameterElement> parameters = new List<ParameterElement>(count); | 2215 List<ParameterElement> parameters = new List<ParameterElement>(count); |
| 1977 for (int i = 0; i < count; i++) { | 2216 for (int i = 0; i < count; i++) { |
| 1978 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.
identifier3("a${i}")); | 2217 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.
identifier3("a${i}")); |
| 1979 parameter.type = argumentTypes[i]; | 2218 parameter.type = argumentTypes[i]; |
| 1980 parameter.parameterKind = ParameterKind.REQUIRED; | 2219 parameter.parameterKind = ParameterKind.REQUIRED; |
| 1981 parameters[i] = parameter; | 2220 parameters[i] = parameter; |
| 1982 } | 2221 } |
| 1983 method.parameters = parameters; | 2222 method.parameters = parameters; |
| 1984 method.returnType = returnType; | 2223 method.returnType = returnType; |
| 1985 FunctionTypeImpl methodType = new FunctionTypeImpl.con1(method); | 2224 FunctionTypeImpl methodType = new FunctionTypeImpl.con1(method); |
| 1986 method.type = methodType; | 2225 method.type = methodType; |
| 1987 return method; | 2226 return method; |
| 1988 } | 2227 } |
| 2228 |
| 1989 static ParameterElementImpl namedParameter(String name) { | 2229 static ParameterElementImpl namedParameter(String name) { |
| 1990 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); | 2230 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); |
| 1991 parameter.parameterKind = ParameterKind.NAMED; | 2231 parameter.parameterKind = ParameterKind.NAMED; |
| 1992 return parameter; | 2232 return parameter; |
| 1993 } | 2233 } |
| 2234 |
| 1994 static ParameterElementImpl namedParameter2(String name, Type2 type) { | 2235 static ParameterElementImpl namedParameter2(String name, Type2 type) { |
| 1995 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); | 2236 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); |
| 1996 parameter.parameterKind = ParameterKind.NAMED; | 2237 parameter.parameterKind = ParameterKind.NAMED; |
| 1997 parameter.type = type; | 2238 parameter.type = type; |
| 1998 return parameter; | 2239 return parameter; |
| 1999 } | 2240 } |
| 2241 |
| 2000 static ParameterElementImpl positionalParameter(String name) { | 2242 static ParameterElementImpl positionalParameter(String name) { |
| 2001 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); | 2243 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); |
| 2002 parameter.parameterKind = ParameterKind.POSITIONAL; | 2244 parameter.parameterKind = ParameterKind.POSITIONAL; |
| 2003 return parameter; | 2245 return parameter; |
| 2004 } | 2246 } |
| 2247 |
| 2005 static ParameterElementImpl positionalParameter2(String name, Type2 type) { | 2248 static ParameterElementImpl positionalParameter2(String name, Type2 type) { |
| 2006 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); | 2249 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); |
| 2007 parameter.parameterKind = ParameterKind.POSITIONAL; | 2250 parameter.parameterKind = ParameterKind.POSITIONAL; |
| 2008 parameter.type = type; | 2251 parameter.type = type; |
| 2009 return parameter; | 2252 return parameter; |
| 2010 } | 2253 } |
| 2254 |
| 2011 static PrefixElementImpl prefix(String name) => new PrefixElementImpl(ASTFacto
ry.identifier3(name)); | 2255 static PrefixElementImpl prefix(String name) => new PrefixElementImpl(ASTFacto
ry.identifier3(name)); |
| 2256 |
| 2012 static ParameterElementImpl requiredParameter(String name) { | 2257 static ParameterElementImpl requiredParameter(String name) { |
| 2013 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); | 2258 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); |
| 2014 parameter.parameterKind = ParameterKind.REQUIRED; | 2259 parameter.parameterKind = ParameterKind.REQUIRED; |
| 2015 return parameter; | 2260 return parameter; |
| 2016 } | 2261 } |
| 2262 |
| 2017 static ParameterElementImpl requiredParameter2(String name, Type2 type) { | 2263 static ParameterElementImpl requiredParameter2(String name, Type2 type) { |
| 2018 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); | 2264 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.id
entifier3(name)); |
| 2019 parameter.parameterKind = ParameterKind.REQUIRED; | 2265 parameter.parameterKind = ParameterKind.REQUIRED; |
| 2020 parameter.type = type; | 2266 parameter.type = type; |
| 2021 return parameter; | 2267 return parameter; |
| 2022 } | 2268 } |
| 2269 |
| 2023 static PropertyAccessorElementImpl setterElement(String name, bool isStatic, T
ype2 type) { | 2270 static PropertyAccessorElementImpl setterElement(String name, bool isStatic, T
ype2 type) { |
| 2024 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); | 2271 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); |
| 2025 field.static = isStatic; | 2272 field.static = isStatic; |
| 2026 field.synthetic = true; | 2273 field.synthetic = true; |
| 2027 field.type = type; | 2274 field.type = type; |
| 2028 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); | 2275 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); |
| 2029 getter.getter = true; | 2276 getter.getter = true; |
| 2030 getter.static = isStatic; | 2277 getter.static = isStatic; |
| 2031 getter.variable = field; | 2278 getter.variable = field; |
| 2032 getter.returnType = type; | 2279 getter.returnType = type; |
| 2033 field.getter = getter; | 2280 field.getter = getter; |
| 2034 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); | 2281 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); |
| 2035 getter.type = getterType; | 2282 getter.type = getterType; |
| 2036 ParameterElementImpl parameter = requiredParameter2("a", type); | 2283 ParameterElementImpl parameter = requiredParameter2("a", type); |
| 2037 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(fi
eld); | 2284 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(fi
eld); |
| 2038 setter.setter = true; | 2285 setter.setter = true; |
| 2039 setter.static = isStatic; | 2286 setter.static = isStatic; |
| 2040 setter.synthetic = true; | 2287 setter.synthetic = true; |
| 2041 setter.variable = field; | 2288 setter.variable = field; |
| 2042 setter.parameters = <ParameterElement> [parameter]; | 2289 setter.parameters = <ParameterElement> [parameter]; |
| 2043 setter.returnType = VoidTypeImpl.instance; | 2290 setter.returnType = VoidTypeImpl.instance; |
| 2044 setter.type = new FunctionTypeImpl.con1(setter); | 2291 setter.type = new FunctionTypeImpl.con1(setter); |
| 2045 field.setter = setter; | 2292 field.setter = setter; |
| 2046 return setter; | 2293 return setter; |
| 2047 } | 2294 } |
| 2295 |
| 2048 static TopLevelVariableElementImpl topLevelVariableElement(Identifier name) =>
new TopLevelVariableElementImpl.con1(name); | 2296 static TopLevelVariableElementImpl topLevelVariableElement(Identifier name) =>
new TopLevelVariableElementImpl.con1(name); |
| 2297 |
| 2049 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => ne
w TopLevelVariableElementImpl.con2(name); | 2298 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => ne
w TopLevelVariableElementImpl.con2(name); |
| 2050 static TopLevelVariableElementImpl topLevelVariableElement3(String name, bool
isFinal, Type2 type) { | 2299 |
| 2300 static TopLevelVariableElementImpl topLevelVariableElement3(String name, bool
isConst, bool isFinal, Type2 type) { |
| 2051 TopLevelVariableElementImpl variable = new TopLevelVariableElementImpl.con2(
name); | 2301 TopLevelVariableElementImpl variable = new TopLevelVariableElementImpl.con2(
name); |
| 2302 variable.const3 = isConst; |
| 2052 variable.final2 = isFinal; | 2303 variable.final2 = isFinal; |
| 2053 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(va
riable); | 2304 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(va
riable); |
| 2054 getter.getter = true; | 2305 getter.getter = true; |
| 2055 getter.static = true; | 2306 getter.static = true; |
| 2056 getter.synthetic = true; | 2307 getter.synthetic = true; |
| 2057 getter.variable = variable; | 2308 getter.variable = variable; |
| 2058 getter.returnType = type; | 2309 getter.returnType = type; |
| 2059 variable.getter = getter; | 2310 variable.getter = getter; |
| 2060 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); | 2311 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); |
| 2061 getter.type = getterType; | 2312 getter.type = getterType; |
| 2062 if (!isFinal) { | 2313 if (!isFinal) { |
| 2063 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(
variable); | 2314 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(
variable); |
| 2064 setter.setter = true; | 2315 setter.setter = true; |
| 2065 setter.static = true; | 2316 setter.static = true; |
| 2066 setter.synthetic = true; | 2317 setter.synthetic = true; |
| 2067 setter.variable = variable; | 2318 setter.variable = variable; |
| 2068 setter.parameters = <ParameterElement> [requiredParameter2("_${name}", typ
e)]; | 2319 setter.parameters = <ParameterElement> [requiredParameter2("_${name}", typ
e)]; |
| 2069 setter.returnType = VoidTypeImpl.instance; | 2320 setter.returnType = VoidTypeImpl.instance; |
| 2070 setter.type = new FunctionTypeImpl.con1(setter); | 2321 setter.type = new FunctionTypeImpl.con1(setter); |
| 2071 variable.setter = setter; | 2322 variable.setter = setter; |
| 2072 } | 2323 } |
| 2073 return variable; | 2324 return variable; |
| 2074 } | 2325 } |
| 2075 } | 2326 } |
| 2327 |
| 2076 class ElementKindTest extends EngineTestCase { | 2328 class ElementKindTest extends EngineTestCase { |
| 2077 void test_of_nonNull() { | 2329 void test_of_nonNull() { |
| 2078 JUnitTestCase.assertSame(ElementKind.CLASS, ElementKind.of(ElementFactory.cl
assElement2("A", []))); | 2330 JUnitTestCase.assertSame(ElementKind.CLASS, ElementKind.of(ElementFactory.cl
assElement2("A", []))); |
| 2079 } | 2331 } |
| 2332 |
| 2080 void test_of_null() { | 2333 void test_of_null() { |
| 2081 JUnitTestCase.assertSame(ElementKind.ERROR, ElementKind.of(null)); | 2334 JUnitTestCase.assertSame(ElementKind.ERROR, ElementKind.of(null)); |
| 2082 } | 2335 } |
| 2336 |
| 2083 static dartSuite() { | 2337 static dartSuite() { |
| 2084 _ut.group('ElementKindTest', () { | 2338 _ut.group('ElementKindTest', () { |
| 2085 _ut.test('test_of_nonNull', () { | 2339 _ut.test('test_of_nonNull', () { |
| 2086 final __test = new ElementKindTest(); | 2340 final __test = new ElementKindTest(); |
| 2087 runJUnitTest(__test, __test.test_of_nonNull); | 2341 runJUnitTest(__test, __test.test_of_nonNull); |
| 2088 }); | 2342 }); |
| 2089 _ut.test('test_of_null', () { | 2343 _ut.test('test_of_null', () { |
| 2090 final __test = new ElementKindTest(); | 2344 final __test = new ElementKindTest(); |
| 2091 runJUnitTest(__test, __test.test_of_null); | 2345 runJUnitTest(__test, __test.test_of_null); |
| 2092 }); | 2346 }); |
| 2093 }); | 2347 }); |
| 2094 } | 2348 } |
| 2095 } | 2349 } |
| 2350 |
| 2096 class ClassElementImplTest extends EngineTestCase { | 2351 class ClassElementImplTest extends EngineTestCase { |
| 2097 void test_getAllSupertypes_interface() { | 2352 void test_getAllSupertypes_interface() { |
| 2098 ClassElement classA = ElementFactory.classElement2("A", []); | 2353 ClassElement classA = ElementFactory.classElement2("A", []); |
| 2099 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 2354 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 2100 ClassElementImpl elementC = ElementFactory.classElement2("C", []); | 2355 ClassElementImpl elementC = ElementFactory.classElement2("C", []); |
| 2101 InterfaceType typeObject = classA.supertype; | 2356 InterfaceType typeObject = classA.supertype; |
| 2102 InterfaceType typeA = classA.type; | 2357 InterfaceType typeA = classA.type; |
| 2103 InterfaceType typeB = classB.type; | 2358 InterfaceType typeB = classB.type; |
| 2104 InterfaceType typeC = elementC.type; | 2359 InterfaceType typeC = elementC.type; |
| 2105 elementC.interfaces = <InterfaceType> [typeB]; | 2360 elementC.interfaces = <InterfaceType> [typeB]; |
| 2106 List<InterfaceType> supers = elementC.allSupertypes; | 2361 List<InterfaceType> supers = elementC.allSupertypes; |
| 2107 List<InterfaceType> types = new List<InterfaceType>(); | 2362 List<InterfaceType> types = new List<InterfaceType>(); |
| 2108 types.addAll(supers); | 2363 types.addAll(supers); |
| 2109 JUnitTestCase.assertTrue(types.contains(typeA)); | 2364 JUnitTestCase.assertTrue(types.contains(typeA)); |
| 2110 JUnitTestCase.assertTrue(types.contains(typeB)); | 2365 JUnitTestCase.assertTrue(types.contains(typeB)); |
| 2111 JUnitTestCase.assertTrue(types.contains(typeObject)); | 2366 JUnitTestCase.assertTrue(types.contains(typeObject)); |
| 2112 JUnitTestCase.assertFalse(types.contains(typeC)); | 2367 JUnitTestCase.assertFalse(types.contains(typeC)); |
| 2113 } | 2368 } |
| 2369 |
| 2114 void test_getAllSupertypes_mixins() { | 2370 void test_getAllSupertypes_mixins() { |
| 2115 ClassElement classA = ElementFactory.classElement2("A", []); | 2371 ClassElement classA = ElementFactory.classElement2("A", []); |
| 2116 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 2372 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 2117 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 2373 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 2118 InterfaceType typeObject = classA.supertype; | 2374 InterfaceType typeObject = classA.supertype; |
| 2119 InterfaceType typeA = classA.type; | 2375 InterfaceType typeA = classA.type; |
| 2120 InterfaceType typeB = classB.type; | 2376 InterfaceType typeB = classB.type; |
| 2121 InterfaceType typeC = classC.type; | 2377 InterfaceType typeC = classC.type; |
| 2122 classC.mixins = <InterfaceType> [typeB]; | 2378 classC.mixins = <InterfaceType> [typeB]; |
| 2123 List<InterfaceType> supers = classC.allSupertypes; | 2379 List<InterfaceType> supers = classC.allSupertypes; |
| 2124 List<InterfaceType> types = new List<InterfaceType>(); | 2380 List<InterfaceType> types = new List<InterfaceType>(); |
| 2125 types.addAll(supers); | 2381 types.addAll(supers); |
| 2126 JUnitTestCase.assertFalse(types.contains(typeA)); | 2382 JUnitTestCase.assertFalse(types.contains(typeA)); |
| 2127 JUnitTestCase.assertTrue(types.contains(typeB)); | 2383 JUnitTestCase.assertTrue(types.contains(typeB)); |
| 2128 JUnitTestCase.assertTrue(types.contains(typeObject)); | 2384 JUnitTestCase.assertTrue(types.contains(typeObject)); |
| 2129 JUnitTestCase.assertFalse(types.contains(typeC)); | 2385 JUnitTestCase.assertFalse(types.contains(typeC)); |
| 2130 } | 2386 } |
| 2387 |
| 2131 void test_getAllSupertypes_recursive() { | 2388 void test_getAllSupertypes_recursive() { |
| 2132 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2389 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2133 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2390 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 2134 classA.supertype = classB.type; | 2391 classA.supertype = classB.type; |
| 2135 List<InterfaceType> supers = classB.allSupertypes; | 2392 List<InterfaceType> supers = classB.allSupertypes; |
| 2136 EngineTestCase.assertLength(1, supers); | 2393 EngineTestCase.assertLength(1, supers); |
| 2137 } | 2394 } |
| 2395 |
| 2138 void test_getMethod_declared() { | 2396 void test_getMethod_declared() { |
| 2139 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2397 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2140 String methodName = "m"; | 2398 String methodName = "m"; |
| 2141 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 2399 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
| 2142 classA.methods = <MethodElement> [method]; | 2400 classA.methods = <MethodElement> [method]; |
| 2143 JUnitTestCase.assertSame(method, classA.getMethod(methodName)); | 2401 JUnitTestCase.assertSame(method, classA.getMethod(methodName)); |
| 2144 } | 2402 } |
| 2403 |
| 2145 void test_getMethod_undeclared() { | 2404 void test_getMethod_undeclared() { |
| 2146 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2405 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2147 String methodName = "m"; | 2406 String methodName = "m"; |
| 2148 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 2407 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
| 2149 classA.methods = <MethodElement> [method]; | 2408 classA.methods = <MethodElement> [method]; |
| 2150 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); | 2409 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); |
| 2151 } | 2410 } |
| 2411 |
| 2152 void test_hasNonFinalField_false_const() { | 2412 void test_hasNonFinalField_false_const() { |
| 2153 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2413 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2154 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, true, classA.type)]; | 2414 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, true, classA.type)]; |
| 2155 JUnitTestCase.assertFalse(classA.hasNonFinalField()); | 2415 JUnitTestCase.assertFalse(classA.hasNonFinalField()); |
| 2156 } | 2416 } |
| 2417 |
| 2157 void test_hasNonFinalField_false_final() { | 2418 void test_hasNonFinalField_false_final() { |
| 2158 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2419 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2159 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, true
, false, classA.type)]; | 2420 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, true
, false, classA.type)]; |
| 2160 JUnitTestCase.assertFalse(classA.hasNonFinalField()); | 2421 JUnitTestCase.assertFalse(classA.hasNonFinalField()); |
| 2161 } | 2422 } |
| 2423 |
| 2162 void test_hasNonFinalField_false_recursive() { | 2424 void test_hasNonFinalField_false_recursive() { |
| 2163 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2425 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2164 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2426 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 2165 classA.supertype = classB.type; | 2427 classA.supertype = classB.type; |
| 2166 JUnitTestCase.assertFalse(classA.hasNonFinalField()); | 2428 JUnitTestCase.assertFalse(classA.hasNonFinalField()); |
| 2167 } | 2429 } |
| 2430 |
| 2168 void test_hasNonFinalField_true_immediate() { | 2431 void test_hasNonFinalField_true_immediate() { |
| 2169 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2432 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2170 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; | 2433 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; |
| 2171 JUnitTestCase.assertTrue(classA.hasNonFinalField()); | 2434 JUnitTestCase.assertTrue(classA.hasNonFinalField()); |
| 2172 } | 2435 } |
| 2436 |
| 2173 void test_hasNonFinalField_true_inherited() { | 2437 void test_hasNonFinalField_true_inherited() { |
| 2174 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2438 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2175 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2439 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 2176 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; | 2440 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; |
| 2177 JUnitTestCase.assertTrue(classB.hasNonFinalField()); | 2441 JUnitTestCase.assertTrue(classB.hasNonFinalField()); |
| 2178 } | 2442 } |
| 2443 |
| 2179 void test_lookUpGetter_declared() { | 2444 void test_lookUpGetter_declared() { |
| 2180 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2445 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2181 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2446 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2182 String getterName = "g"; | 2447 String getterName = "g"; |
| 2183 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); | 2448 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); |
| 2184 classA.accessors = <PropertyAccessorElement> [getter]; | 2449 classA.accessors = <PropertyAccessorElement> [getter]; |
| 2185 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; | 2450 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA]; |
| 2186 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library)); | 2451 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library)); |
| 2187 } | 2452 } |
| 2453 |
| 2188 void test_lookUpGetter_inherited() { | 2454 void test_lookUpGetter_inherited() { |
| 2189 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2455 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2190 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2456 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2191 String getterName = "g"; | 2457 String getterName = "g"; |
| 2192 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); | 2458 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); |
| 2193 classA.accessors = <PropertyAccessorElement> [getter]; | 2459 classA.accessors = <PropertyAccessorElement> [getter]; |
| 2194 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2460 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 2195 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; | 2461 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA, classB]; |
| 2196 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library)); | 2462 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library)); |
| 2197 } | 2463 } |
| 2464 |
| 2198 void test_lookUpGetter_undeclared() { | 2465 void test_lookUpGetter_undeclared() { |
| 2199 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2466 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2200 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2467 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2201 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; | 2468 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA]; |
| 2202 JUnitTestCase.assertNull(classA.lookUpGetter("g", library)); | 2469 JUnitTestCase.assertNull(classA.lookUpGetter("g", library)); |
| 2203 } | 2470 } |
| 2471 |
| 2204 void test_lookUpGetter_undeclared_recursive() { | 2472 void test_lookUpGetter_undeclared_recursive() { |
| 2205 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2473 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2206 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2474 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2207 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2475 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 2208 classA.supertype = classB.type; | 2476 classA.supertype = classB.type; |
| 2209 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; | 2477 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA, classB]; |
| 2210 JUnitTestCase.assertNull(classA.lookUpGetter("g", library)); | 2478 JUnitTestCase.assertNull(classA.lookUpGetter("g", library)); |
| 2211 } | 2479 } |
| 2480 |
| 2212 void test_lookUpMethod_declared() { | 2481 void test_lookUpMethod_declared() { |
| 2213 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2482 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2214 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2483 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2215 String methodName = "m"; | 2484 String methodName = "m"; |
| 2216 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 2485 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
| 2217 classA.methods = <MethodElement> [method]; | 2486 classA.methods = <MethodElement> [method]; |
| 2218 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; | 2487 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA]; |
| 2219 JUnitTestCase.assertSame(method, classA.lookUpMethod(methodName, library)); | 2488 JUnitTestCase.assertSame(method, classA.lookUpMethod(methodName, library)); |
| 2220 } | 2489 } |
| 2490 |
| 2221 void test_lookUpMethod_inherited() { | 2491 void test_lookUpMethod_inherited() { |
| 2222 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2492 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2223 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2493 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2224 String methodName = "m"; | 2494 String methodName = "m"; |
| 2225 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 2495 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
| 2226 classA.methods = <MethodElement> [method]; | 2496 classA.methods = <MethodElement> [method]; |
| 2227 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2497 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 2228 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; | 2498 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA, classB]; |
| 2229 JUnitTestCase.assertSame(method, classB.lookUpMethod(methodName, library)); | 2499 JUnitTestCase.assertSame(method, classB.lookUpMethod(methodName, library)); |
| 2230 } | 2500 } |
| 2501 |
| 2231 void test_lookUpMethod_undeclared() { | 2502 void test_lookUpMethod_undeclared() { |
| 2232 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2503 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2233 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2504 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2234 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; | 2505 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA]; |
| 2235 JUnitTestCase.assertNull(classA.lookUpMethod("m", library)); | 2506 JUnitTestCase.assertNull(classA.lookUpMethod("m", library)); |
| 2236 } | 2507 } |
| 2508 |
| 2237 void test_lookUpMethod_undeclared_recursive() { | 2509 void test_lookUpMethod_undeclared_recursive() { |
| 2238 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2510 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2239 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2511 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2240 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2512 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 2241 classA.supertype = classB.type; | 2513 classA.supertype = classB.type; |
| 2242 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; | 2514 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA, classB]; |
| 2243 JUnitTestCase.assertNull(classA.lookUpMethod("m", library)); | 2515 JUnitTestCase.assertNull(classA.lookUpMethod("m", library)); |
| 2244 } | 2516 } |
| 2517 |
| 2245 void test_lookUpSetter_declared() { | 2518 void test_lookUpSetter_declared() { |
| 2246 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2519 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2247 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2520 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2248 String setterName = "s"; | 2521 String setterName = "s"; |
| 2249 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); | 2522 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); |
| 2250 classA.accessors = <PropertyAccessorElement> [setter]; | 2523 classA.accessors = <PropertyAccessorElement> [setter]; |
| 2251 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; | 2524 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA]; |
| 2252 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library)); | 2525 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library)); |
| 2253 } | 2526 } |
| 2527 |
| 2254 void test_lookUpSetter_inherited() { | 2528 void test_lookUpSetter_inherited() { |
| 2255 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2529 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2256 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2530 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2257 String setterName = "s"; | 2531 String setterName = "s"; |
| 2258 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); | 2532 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); |
| 2259 classA.accessors = <PropertyAccessorElement> [setter]; | 2533 classA.accessors = <PropertyAccessorElement> [setter]; |
| 2260 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2534 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 2261 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; | 2535 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA, classB]; |
| 2262 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library)); | 2536 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library)); |
| 2263 } | 2537 } |
| 2538 |
| 2264 void test_lookUpSetter_undeclared() { | 2539 void test_lookUpSetter_undeclared() { |
| 2265 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2540 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2266 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2541 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2267 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA]; | 2542 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA]; |
| 2268 JUnitTestCase.assertNull(classA.lookUpSetter("s", library)); | 2543 JUnitTestCase.assertNull(classA.lookUpSetter("s", library)); |
| 2269 } | 2544 } |
| 2545 |
| 2270 void test_lookUpSetter_undeclared_recursive() { | 2546 void test_lookUpSetter_undeclared_recursive() { |
| 2271 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2547 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2272 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2548 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2273 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 2549 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 2274 classA.supertype = classB.type; | 2550 classA.supertype = classB.type; |
| 2275 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classA, classB]; | 2551 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classA, classB]; |
| 2276 JUnitTestCase.assertNull(classA.lookUpSetter("s", library)); | 2552 JUnitTestCase.assertNull(classA.lookUpSetter("s", library)); |
| 2277 } | 2553 } |
| 2554 |
| 2278 static dartSuite() { | 2555 static dartSuite() { |
| 2279 _ut.group('ClassElementImplTest', () { | 2556 _ut.group('ClassElementImplTest', () { |
| 2280 _ut.test('test_getAllSupertypes_interface', () { | 2557 _ut.test('test_getAllSupertypes_interface', () { |
| 2281 final __test = new ClassElementImplTest(); | 2558 final __test = new ClassElementImplTest(); |
| 2282 runJUnitTest(__test, __test.test_getAllSupertypes_interface); | 2559 runJUnitTest(__test, __test.test_getAllSupertypes_interface); |
| 2283 }); | 2560 }); |
| 2284 _ut.test('test_getAllSupertypes_mixins', () { | 2561 _ut.test('test_getAllSupertypes_mixins', () { |
| 2285 final __test = new ClassElementImplTest(); | 2562 final __test = new ClassElementImplTest(); |
| 2286 runJUnitTest(__test, __test.test_getAllSupertypes_mixins); | 2563 runJUnitTest(__test, __test.test_getAllSupertypes_mixins); |
| 2287 }); | 2564 }); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2361 final __test = new ClassElementImplTest(); | 2638 final __test = new ClassElementImplTest(); |
| 2362 runJUnitTest(__test, __test.test_lookUpSetter_undeclared); | 2639 runJUnitTest(__test, __test.test_lookUpSetter_undeclared); |
| 2363 }); | 2640 }); |
| 2364 _ut.test('test_lookUpSetter_undeclared_recursive', () { | 2641 _ut.test('test_lookUpSetter_undeclared_recursive', () { |
| 2365 final __test = new ClassElementImplTest(); | 2642 final __test = new ClassElementImplTest(); |
| 2366 runJUnitTest(__test, __test.test_lookUpSetter_undeclared_recursive); | 2643 runJUnitTest(__test, __test.test_lookUpSetter_undeclared_recursive); |
| 2367 }); | 2644 }); |
| 2368 }); | 2645 }); |
| 2369 } | 2646 } |
| 2370 } | 2647 } |
| 2648 |
| 2371 class ElementImplTest extends EngineTestCase { | 2649 class ElementImplTest extends EngineTestCase { |
| 2372 void test_equals() { | 2650 void test_equals() { |
| 2373 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2651 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2374 ClassElementImpl classElement = ElementFactory.classElement2("C", []); | 2652 ClassElementImpl classElement = ElementFactory.classElement2("C", []); |
| 2375 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classElement]; | 2653 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classElement]; |
| 2376 FieldElement field = ElementFactory.fieldElement("next", false, false, false
, classElement.type); | 2654 FieldElement field = ElementFactory.fieldElement("next", false, false, false
, classElement.type); |
| 2377 classElement.fields = <FieldElement> [field]; | 2655 classElement.fields = <FieldElement> [field]; |
| 2378 JUnitTestCase.assertTrue(field == field); | 2656 JUnitTestCase.assertTrue(field == field); |
| 2379 JUnitTestCase.assertFalse(field == field.getter); | 2657 JUnitTestCase.assertFalse(field == field.getter); |
| 2380 JUnitTestCase.assertFalse(field == field.setter); | 2658 JUnitTestCase.assertFalse(field == field.setter); |
| 2381 JUnitTestCase.assertFalse(field.getter == field.setter); | 2659 JUnitTestCase.assertFalse(field.getter == field.setter); |
| 2382 } | 2660 } |
| 2661 |
| 2383 void test_isAccessibleIn_private_differentLibrary() { | 2662 void test_isAccessibleIn_private_differentLibrary() { |
| 2384 AnalysisContextImpl context = createAnalysisContext(); | 2663 AnalysisContextImpl context = createAnalysisContext(); |
| 2385 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); | 2664 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); |
| 2386 ClassElement classElement = ElementFactory.classElement2("_C", []); | 2665 ClassElement classElement = ElementFactory.classElement2("_C", []); |
| 2387 ((library1.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classElement]; | 2666 (library1.definingCompilationUnit as CompilationUnitElementImpl).types = <Cl
assElement> [classElement]; |
| 2388 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); | 2667 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); |
| 2389 JUnitTestCase.assertFalse(classElement.isAccessibleIn(library2)); | 2668 JUnitTestCase.assertFalse(classElement.isAccessibleIn(library2)); |
| 2390 } | 2669 } |
| 2670 |
| 2391 void test_isAccessibleIn_private_sameLibrary() { | 2671 void test_isAccessibleIn_private_sameLibrary() { |
| 2392 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2672 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2393 ClassElement classElement = ElementFactory.classElement2("_C", []); | 2673 ClassElement classElement = ElementFactory.classElement2("_C", []); |
| 2394 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classElement]; | 2674 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classElement]; |
| 2395 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library)); | 2675 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library)); |
| 2396 } | 2676 } |
| 2677 |
| 2397 void test_isAccessibleIn_public_differentLibrary() { | 2678 void test_isAccessibleIn_public_differentLibrary() { |
| 2398 AnalysisContextImpl context = createAnalysisContext(); | 2679 AnalysisContextImpl context = createAnalysisContext(); |
| 2399 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); | 2680 LibraryElementImpl library1 = ElementFactory.library(context, "lib1"); |
| 2400 ClassElement classElement = ElementFactory.classElement2("C", []); | 2681 ClassElement classElement = ElementFactory.classElement2("C", []); |
| 2401 ((library1.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classElement]; | 2682 (library1.definingCompilationUnit as CompilationUnitElementImpl).types = <Cl
assElement> [classElement]; |
| 2402 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); | 2683 LibraryElementImpl library2 = ElementFactory.library(context, "lib2"); |
| 2403 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2)); | 2684 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2)); |
| 2404 } | 2685 } |
| 2686 |
| 2405 void test_isAccessibleIn_public_sameLibrary() { | 2687 void test_isAccessibleIn_public_sameLibrary() { |
| 2406 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2688 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2407 ClassElement classElement = ElementFactory.classElement2("C", []); | 2689 ClassElement classElement = ElementFactory.classElement2("C", []); |
| 2408 ((library.definingCompilationUnit as CompilationUnitElementImpl)).types = <C
lassElement> [classElement]; | 2690 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classElement]; |
| 2409 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library)); | 2691 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library)); |
| 2410 } | 2692 } |
| 2693 |
| 2411 void test_SORT_BY_OFFSET() { | 2694 void test_SORT_BY_OFFSET() { |
| 2412 ClassElementImpl classElementA = ElementFactory.classElement2("A", []); | 2695 ClassElementImpl classElementA = ElementFactory.classElement2("A", []); |
| 2413 classElementA.nameOffset = 1; | 2696 classElementA.nameOffset = 1; |
| 2414 ClassElementImpl classElementB = ElementFactory.classElement2("B", []); | 2697 ClassElementImpl classElementB = ElementFactory.classElement2("B", []); |
| 2415 classElementB.nameOffset = 2; | 2698 classElementB.nameOffset = 2; |
| 2416 JUnitTestCase.assertEquals(0, Element.SORT_BY_OFFSET(classElementA, classEle
mentA)); | 2699 JUnitTestCase.assertEquals(0, Element.SORT_BY_OFFSET(classElementA, classEle
mentA)); |
| 2417 JUnitTestCase.assertTrue(Element.SORT_BY_OFFSET(classElementA, classElementB
) < 0); | 2700 JUnitTestCase.assertTrue(Element.SORT_BY_OFFSET(classElementA, classElementB
) < 0); |
| 2418 JUnitTestCase.assertTrue(Element.SORT_BY_OFFSET(classElementB, classElementA
) > 0); | 2701 JUnitTestCase.assertTrue(Element.SORT_BY_OFFSET(classElementB, classElementA
) > 0); |
| 2419 } | 2702 } |
| 2703 |
| 2420 static dartSuite() { | 2704 static dartSuite() { |
| 2421 _ut.group('ElementImplTest', () { | 2705 _ut.group('ElementImplTest', () { |
| 2422 _ut.test('test_SORT_BY_OFFSET', () { | 2706 _ut.test('test_SORT_BY_OFFSET', () { |
| 2423 final __test = new ElementImplTest(); | 2707 final __test = new ElementImplTest(); |
| 2424 runJUnitTest(__test, __test.test_SORT_BY_OFFSET); | 2708 runJUnitTest(__test, __test.test_SORT_BY_OFFSET); |
| 2425 }); | 2709 }); |
| 2426 _ut.test('test_equals', () { | 2710 _ut.test('test_equals', () { |
| 2427 final __test = new ElementImplTest(); | 2711 final __test = new ElementImplTest(); |
| 2428 runJUnitTest(__test, __test.test_equals); | 2712 runJUnitTest(__test, __test.test_equals); |
| 2429 }); | 2713 }); |
| 2430 _ut.test('test_isAccessibleIn_private_differentLibrary', () { | 2714 _ut.test('test_isAccessibleIn_private_differentLibrary', () { |
| 2431 final __test = new ElementImplTest(); | 2715 final __test = new ElementImplTest(); |
| 2432 runJUnitTest(__test, __test.test_isAccessibleIn_private_differentLibrary
); | 2716 runJUnitTest(__test, __test.test_isAccessibleIn_private_differentLibrary
); |
| 2433 }); | 2717 }); |
| 2434 _ut.test('test_isAccessibleIn_private_sameLibrary', () { | 2718 _ut.test('test_isAccessibleIn_private_sameLibrary', () { |
| 2435 final __test = new ElementImplTest(); | 2719 final __test = new ElementImplTest(); |
| 2436 runJUnitTest(__test, __test.test_isAccessibleIn_private_sameLibrary); | 2720 runJUnitTest(__test, __test.test_isAccessibleIn_private_sameLibrary); |
| 2437 }); | 2721 }); |
| 2438 _ut.test('test_isAccessibleIn_public_differentLibrary', () { | 2722 _ut.test('test_isAccessibleIn_public_differentLibrary', () { |
| 2439 final __test = new ElementImplTest(); | 2723 final __test = new ElementImplTest(); |
| 2440 runJUnitTest(__test, __test.test_isAccessibleIn_public_differentLibrary)
; | 2724 runJUnitTest(__test, __test.test_isAccessibleIn_public_differentLibrary)
; |
| 2441 }); | 2725 }); |
| 2442 _ut.test('test_isAccessibleIn_public_sameLibrary', () { | 2726 _ut.test('test_isAccessibleIn_public_sameLibrary', () { |
| 2443 final __test = new ElementImplTest(); | 2727 final __test = new ElementImplTest(); |
| 2444 runJUnitTest(__test, __test.test_isAccessibleIn_public_sameLibrary); | 2728 runJUnitTest(__test, __test.test_isAccessibleIn_public_sameLibrary); |
| 2445 }); | 2729 }); |
| 2446 }); | 2730 }); |
| 2447 } | 2731 } |
| 2448 } | 2732 } |
| 2733 |
| 2449 class FunctionTypeImplTest extends EngineTestCase { | 2734 class FunctionTypeImplTest extends EngineTestCase { |
| 2450 void test_creation() { | 2735 void test_creation() { |
| 2451 JUnitTestCase.assertNotNull(new FunctionTypeImpl.con1(new FunctionElementImp
l.con1(ASTFactory.identifier3("f")))); | 2736 JUnitTestCase.assertNotNull(new FunctionTypeImpl.con1(new FunctionElementImp
l.con1(ASTFactory.identifier3("f")))); |
| 2452 } | 2737 } |
| 2738 |
| 2453 void test_getElement() { | 2739 void test_getElement() { |
| 2454 FunctionElementImpl typeElement = new FunctionElementImpl.con1(ASTFactory.id
entifier3("f")); | 2740 FunctionElementImpl typeElement = new FunctionElementImpl.con1(ASTFactory.id
entifier3("f")); |
| 2455 FunctionTypeImpl type = new FunctionTypeImpl.con1(typeElement); | 2741 FunctionTypeImpl type = new FunctionTypeImpl.con1(typeElement); |
| 2456 JUnitTestCase.assertEquals(typeElement, type.element); | 2742 JUnitTestCase.assertEquals(typeElement, type.element); |
| 2457 } | 2743 } |
| 2744 |
| 2458 void test_getNamedParameterTypes() { | 2745 void test_getNamedParameterTypes() { |
| 2459 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2746 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2460 Map<String, Type2> types = type.namedParameterTypes; | 2747 Map<String, Type2> types = type.namedParameterTypes; |
| 2461 EngineTestCase.assertSize2(0, types); | 2748 EngineTestCase.assertSize2(0, types); |
| 2462 } | 2749 } |
| 2750 |
| 2463 void test_getNormalParameterTypes() { | 2751 void test_getNormalParameterTypes() { |
| 2464 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2752 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2465 List<Type2> types = type.normalParameterTypes; | 2753 List<Type2> types = type.normalParameterTypes; |
| 2466 EngineTestCase.assertLength(0, types); | 2754 EngineTestCase.assertLength(0, types); |
| 2467 } | 2755 } |
| 2756 |
| 2468 void test_getReturnType() { | 2757 void test_getReturnType() { |
| 2469 Type2 expectedReturnType = VoidTypeImpl.instance; | 2758 Type2 expectedReturnType = VoidTypeImpl.instance; |
| 2470 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3("f")); | 2759 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3("f")); |
| 2471 functionElement.returnType = expectedReturnType; | 2760 functionElement.returnType = expectedReturnType; |
| 2472 FunctionTypeImpl type = new FunctionTypeImpl.con1(functionElement); | 2761 FunctionTypeImpl type = new FunctionTypeImpl.con1(functionElement); |
| 2473 Type2 returnType = type.returnType; | 2762 Type2 returnType = type.returnType; |
| 2474 JUnitTestCase.assertEquals(expectedReturnType, returnType); | 2763 JUnitTestCase.assertEquals(expectedReturnType, returnType); |
| 2475 } | 2764 } |
| 2765 |
| 2476 void test_getTypeArguments() { | 2766 void test_getTypeArguments() { |
| 2477 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2767 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2478 List<Type2> types = type.typeArguments; | 2768 List<Type2> types = type.typeArguments; |
| 2479 EngineTestCase.assertLength(0, types); | 2769 EngineTestCase.assertLength(0, types); |
| 2480 } | 2770 } |
| 2771 |
| 2481 void test_hashCode_element() { | 2772 void test_hashCode_element() { |
| 2482 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2773 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2483 type.hashCode; | 2774 type.hashCode; |
| 2484 } | 2775 } |
| 2776 |
| 2485 void test_hashCode_noElement() { | 2777 void test_hashCode_noElement() { |
| 2486 FunctionTypeImpl type = new FunctionTypeImpl.con1(null as ExecutableElement)
; | 2778 FunctionTypeImpl type = new FunctionTypeImpl.con1(null as ExecutableElement)
; |
| 2487 type.hashCode; | 2779 type.hashCode; |
| 2488 } | 2780 } |
| 2781 |
| 2489 void test_isAssignableTo_normalAndPositionalArgs() { | 2782 void test_isAssignableTo_normalAndPositionalArgs() { |
| 2490 ClassElement a = ElementFactory.classElement2("A", []); | 2783 ClassElement a = ElementFactory.classElement2("A", []); |
| 2491 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 2784 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 2492 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; | 2785 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; |
| 2493 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2786 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2494 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 2787 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 2495 JUnitTestCase.assertTrue(t.isAssignableTo(s)); | 2788 JUnitTestCase.assertTrue(t.isAssignableTo(s)); |
| 2496 JUnitTestCase.assertFalse(s.isAssignableTo(t)); | 2789 JUnitTestCase.assertFalse(s.isAssignableTo(t)); |
| 2497 } | 2790 } |
| 2791 |
| 2498 void test_isSubtypeOf_baseCase_classFunction() { | 2792 void test_isSubtypeOf_baseCase_classFunction() { |
| 2499 ClassElementImpl functionElement = ElementFactory.classElement2("Function",
[]); | 2793 ClassElementImpl functionElement = ElementFactory.classElement2("Function",
[]); |
| 2500 InterfaceTypeImpl functionType = new InterfaceTypeImpl_23(functionElement); | 2794 InterfaceTypeImpl functionType = new InterfaceTypeImpl_24(functionElement); |
| 2501 FunctionType f = ElementFactory.functionElement("f").type; | 2795 FunctionType f = ElementFactory.functionElement("f").type; |
| 2502 JUnitTestCase.assertTrue(f.isSubtypeOf(functionType)); | 2796 JUnitTestCase.assertTrue(f.isSubtypeOf(functionType)); |
| 2503 } | 2797 } |
| 2798 |
| 2504 void test_isSubtypeOf_baseCase_notFunctionType() { | 2799 void test_isSubtypeOf_baseCase_notFunctionType() { |
| 2505 FunctionType f = ElementFactory.functionElement("f").type; | 2800 FunctionType f = ElementFactory.functionElement("f").type; |
| 2506 InterfaceType t = ElementFactory.classElement2("C", []).type; | 2801 InterfaceType t = ElementFactory.classElement2("C", []).type; |
| 2507 JUnitTestCase.assertFalse(f.isSubtypeOf(t)); | 2802 JUnitTestCase.assertFalse(f.isSubtypeOf(t)); |
| 2508 } | 2803 } |
| 2804 |
| 2509 void test_isSubtypeOf_baseCase_null() { | 2805 void test_isSubtypeOf_baseCase_null() { |
| 2510 FunctionType f = ElementFactory.functionElement("f").type; | 2806 FunctionType f = ElementFactory.functionElement("f").type; |
| 2511 JUnitTestCase.assertFalse(f.isSubtypeOf(null)); | 2807 JUnitTestCase.assertFalse(f.isSubtypeOf(null)); |
| 2512 } | 2808 } |
| 2809 |
| 2513 void test_isSubtypeOf_baseCase_self() { | 2810 void test_isSubtypeOf_baseCase_self() { |
| 2514 FunctionType f = ElementFactory.functionElement("f").type; | 2811 FunctionType f = ElementFactory.functionElement("f").type; |
| 2515 JUnitTestCase.assertTrue(f.isSubtypeOf(f)); | 2812 JUnitTestCase.assertTrue(f.isSubtypeOf(f)); |
| 2516 } | 2813 } |
| 2814 |
| 2517 void test_isSubtypeOf_namedParameters_isAssignable() { | 2815 void test_isSubtypeOf_namedParameters_isAssignable() { |
| 2518 ClassElement a = ElementFactory.classElement2("A", []); | 2816 ClassElement a = ElementFactory.classElement2("A", []); |
| 2519 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2817 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2520 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; | 2818 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; |
| 2521 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [b]).type; | 2819 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [b]).type; |
| 2522 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2820 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2523 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); | 2821 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); |
| 2524 } | 2822 } |
| 2823 |
| 2525 void test_isSubtypeOf_namedParameters_isNotAssignable() { | 2824 void test_isSubtypeOf_namedParameters_isNotAssignable() { |
| 2526 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [ElementFactory.classElement2("A", [])]).type; | 2825 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [ElementFactory.classElement2("A", [])]).type; |
| 2527 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [ElementFactory.classElement2("B", [])]).type; | 2826 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [ElementFactory.classElement2("B", [])]).type; |
| 2528 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2827 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2529 } | 2828 } |
| 2829 |
| 2530 void test_isSubtypeOf_namedParameters_namesDifferent() { | 2830 void test_isSubtypeOf_namedParameters_namesDifferent() { |
| 2531 ClassElement a = ElementFactory.classElement2("A", []); | 2831 ClassElement a = ElementFactory.classElement2("A", []); |
| 2532 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2832 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2533 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; | 2833 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; |
| 2534 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"diff"], <ClassElement> [b]).type; | 2834 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"diff"], <ClassElement> [b]).type; |
| 2535 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2835 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2536 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 2836 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 2537 } | 2837 } |
| 2838 |
| 2538 void test_isSubtypeOf_namedParameters_orderOfParams() { | 2839 void test_isSubtypeOf_namedParameters_orderOfParams() { |
| 2539 ClassElement a = ElementFactory.classElement2("A", []); | 2840 ClassElement a = ElementFactory.classElement2("A", []); |
| 2540 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2841 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2541 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"A", "B"], <ClassElement> [a, b]).type; | 2842 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"A", "B"], <ClassElement> [a, b]).type; |
| 2542 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B", "A"], <ClassElement> [b, a]).type; | 2843 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B", "A"], <ClassElement> [b, a]).type; |
| 2543 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2844 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2544 } | 2845 } |
| 2846 |
| 2545 void test_isSubtypeOf_namedParameters_orderOfParams2() { | 2847 void test_isSubtypeOf_namedParameters_orderOfParams2() { |
| 2546 ClassElement a = ElementFactory.classElement2("A", []); | 2848 ClassElement a = ElementFactory.classElement2("A", []); |
| 2547 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2849 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2548 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"B"], <ClassElement> [b]).type; | 2850 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"B"], <ClassElement> [b]).type; |
| 2549 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B", "A"], <ClassElement> [b, a]).type; | 2851 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B", "A"], <ClassElement> [b, a]).type; |
| 2550 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2852 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2551 } | 2853 } |
| 2854 |
| 2552 void test_isSubtypeOf_namedParameters_orderOfParams3() { | 2855 void test_isSubtypeOf_namedParameters_orderOfParams3() { |
| 2553 ClassElement a = ElementFactory.classElement2("A", []); | 2856 ClassElement a = ElementFactory.classElement2("A", []); |
| 2554 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2857 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2555 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"A", "B"], <ClassElement> [a, b]).type; | 2858 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"A", "B"], <ClassElement> [a, b]).type; |
| 2556 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B"], <ClassElement> [b]).type; | 2859 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B"], <ClassElement> [b]).type; |
| 2557 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2860 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2558 } | 2861 } |
| 2862 |
| 2559 void test_isSubtypeOf_namedParameters_sHasMoreParams() { | 2863 void test_isSubtypeOf_namedParameters_sHasMoreParams() { |
| 2560 ClassElement a = ElementFactory.classElement2("A", []); | 2864 ClassElement a = ElementFactory.classElement2("A", []); |
| 2561 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2865 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2562 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; | 2866 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; |
| 2563 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name", "name2"], <ClassElement> [b, b]).type; | 2867 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name", "name2"], <ClassElement> [b, b]).type; |
| 2564 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2868 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2565 } | 2869 } |
| 2870 |
| 2566 void test_isSubtypeOf_namedParameters_tHasMoreParams() { | 2871 void test_isSubtypeOf_namedParameters_tHasMoreParams() { |
| 2567 ClassElement a = ElementFactory.classElement2("A", []); | 2872 ClassElement a = ElementFactory.classElement2("A", []); |
| 2568 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2873 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2569 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name", "name2"], <ClassElement> [a, a]).type; | 2874 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name", "name2"], <ClassElement> [a, a]).type; |
| 2570 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [b]).type; | 2875 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [b]).type; |
| 2571 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2876 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2572 } | 2877 } |
| 2878 |
| 2573 void test_isSubtypeOf_normalAndPositionalArgs_1() { | 2879 void test_isSubtypeOf_normalAndPositionalArgs_1() { |
| 2574 ClassElement a = ElementFactory.classElement2("A", []); | 2880 ClassElement a = ElementFactory.classElement2("A", []); |
| 2575 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 2881 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 2576 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; | 2882 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; |
| 2577 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2883 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2578 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 2884 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 2579 } | 2885 } |
| 2886 |
| 2580 void test_isSubtypeOf_normalAndPositionalArgs_2() { | 2887 void test_isSubtypeOf_normalAndPositionalArgs_2() { |
| 2581 ClassElement a = ElementFactory.classElement2("A", []); | 2888 ClassElement a = ElementFactory.classElement2("A", []); |
| 2582 FunctionType t = ElementFactory.functionElement6("t", <ClassElement> [a], <C
lassElement> [a]).type; | 2889 FunctionType t = ElementFactory.functionElement6("t", <ClassElement> [a], <C
lassElement> [a]).type; |
| 2583 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; | 2890 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; |
| 2584 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2891 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2585 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 2892 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 2586 } | 2893 } |
| 2894 |
| 2587 void test_isSubtypeOf_normalAndPositionalArgs_3() { | 2895 void test_isSubtypeOf_normalAndPositionalArgs_3() { |
| 2588 ClassElement a = ElementFactory.classElement2("A", []); | 2896 ClassElement a = ElementFactory.classElement2("A", []); |
| 2589 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 2897 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 2590 FunctionType s = ElementFactory.functionElement("s").type; | 2898 FunctionType s = ElementFactory.functionElement("s").type; |
| 2591 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2899 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2592 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 2900 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 2593 } | 2901 } |
| 2902 |
| 2594 void test_isSubtypeOf_normalAndPositionalArgs_4() { | 2903 void test_isSubtypeOf_normalAndPositionalArgs_4() { |
| 2595 ClassElement a = ElementFactory.classElement2("A", []); | 2904 ClassElement a = ElementFactory.classElement2("A", []); |
| 2596 ClassElement b = ElementFactory.classElement2("B", []); | 2905 ClassElement b = ElementFactory.classElement2("B", []); |
| 2597 ClassElement c = ElementFactory.classElement2("C", []); | 2906 ClassElement c = ElementFactory.classElement2("C", []); |
| 2598 ClassElement d = ElementFactory.classElement2("D", []); | 2907 ClassElement d = ElementFactory.classElement2("D", []); |
| 2599 ClassElement e = ElementFactory.classElement2("E", []); | 2908 ClassElement e = ElementFactory.classElement2("E", []); |
| 2600 FunctionType t = ElementFactory.functionElement6("t", <ClassElement> [a, b],
<ClassElement> [c, d, e]).type; | 2909 FunctionType t = ElementFactory.functionElement6("t", <ClassElement> [a, b],
<ClassElement> [c, d, e]).type; |
| 2601 FunctionType s = ElementFactory.functionElement6("s", <ClassElement> [a, b,
c], <ClassElement> [d]).type; | 2910 FunctionType s = ElementFactory.functionElement6("s", <ClassElement> [a, b,
c], <ClassElement> [d]).type; |
| 2602 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2911 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2603 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 2912 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 2604 } | 2913 } |
| 2914 |
| 2605 void test_isSubtypeOf_normalParameters_isAssignable() { | 2915 void test_isSubtypeOf_normalParameters_isAssignable() { |
| 2606 ClassElement a = ElementFactory.classElement2("A", []); | 2916 ClassElement a = ElementFactory.classElement2("A", []); |
| 2607 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2917 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2608 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; | 2918 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; |
| 2609 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b]).ty
pe; | 2919 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b]).ty
pe; |
| 2610 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2920 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2611 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); | 2921 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); |
| 2612 } | 2922 } |
| 2923 |
| 2613 void test_isSubtypeOf_normalParameters_isNotAssignable() { | 2924 void test_isSubtypeOf_normalParameters_isNotAssignable() { |
| 2614 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [Elemen
tFactory.classElement2("A", [])]).type; | 2925 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [Elemen
tFactory.classElement2("A", [])]).type; |
| 2615 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [Elemen
tFactory.classElement2("B", [])]).type; | 2926 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [Elemen
tFactory.classElement2("B", [])]).type; |
| 2616 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2927 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2617 } | 2928 } |
| 2929 |
| 2618 void test_isSubtypeOf_normalParameters_sHasMoreParams() { | 2930 void test_isSubtypeOf_normalParameters_sHasMoreParams() { |
| 2619 ClassElement a = ElementFactory.classElement2("A", []); | 2931 ClassElement a = ElementFactory.classElement2("A", []); |
| 2620 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2932 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2621 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; | 2933 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; |
| 2622 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b, b])
.type; | 2934 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b, b])
.type; |
| 2623 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2935 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2624 } | 2936 } |
| 2937 |
| 2625 void test_isSubtypeOf_normalParameters_tHasMoreParams() { | 2938 void test_isSubtypeOf_normalParameters_tHasMoreParams() { |
| 2626 ClassElement a = ElementFactory.classElement2("A", []); | 2939 ClassElement a = ElementFactory.classElement2("A", []); |
| 2627 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2940 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2628 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a, a])
.type; | 2941 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a, a])
.type; |
| 2629 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b]).ty
pe; | 2942 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b]).ty
pe; |
| 2630 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2943 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2631 } | 2944 } |
| 2945 |
| 2632 void test_isSubtypeOf_Object() { | 2946 void test_isSubtypeOf_Object() { |
| 2633 FunctionType f = ElementFactory.functionElement("f").type; | 2947 FunctionType f = ElementFactory.functionElement("f").type; |
| 2634 InterfaceType t = ElementFactory.object.type; | 2948 InterfaceType t = ElementFactory.object.type; |
| 2635 JUnitTestCase.assertTrue(f.isSubtypeOf(t)); | 2949 JUnitTestCase.assertTrue(f.isSubtypeOf(t)); |
| 2636 } | 2950 } |
| 2951 |
| 2637 void test_isSubtypeOf_positionalParameters_isAssignable() { | 2952 void test_isSubtypeOf_positionalParameters_isAssignable() { |
| 2638 ClassElement a = ElementFactory.classElement2("A", []); | 2953 ClassElement a = ElementFactory.classElement2("A", []); |
| 2639 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2954 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2640 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 2955 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 2641 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b]).type; | 2956 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b]).type; |
| 2642 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2957 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2643 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); | 2958 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); |
| 2644 } | 2959 } |
| 2960 |
| 2645 void test_isSubtypeOf_positionalParameters_isNotAssignable() { | 2961 void test_isSubtypeOf_positionalParameters_isNotAssignable() { |
| 2646 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
ElementFactory.classElement2("A", [])]).type; | 2962 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
ElementFactory.classElement2("A", [])]).type; |
| 2647 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
ElementFactory.classElement2("B", [])]).type; | 2963 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
ElementFactory.classElement2("B", [])]).type; |
| 2648 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2964 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2649 } | 2965 } |
| 2966 |
| 2650 void test_isSubtypeOf_positionalParameters_sHasMoreParams() { | 2967 void test_isSubtypeOf_positionalParameters_sHasMoreParams() { |
| 2651 ClassElement a = ElementFactory.classElement2("A", []); | 2968 ClassElement a = ElementFactory.classElement2("A", []); |
| 2652 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2969 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2653 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 2970 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 2654 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b, b]).type; | 2971 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b, b]).type; |
| 2655 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2972 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2656 } | 2973 } |
| 2974 |
| 2657 void test_isSubtypeOf_positionalParameters_tHasMoreParams() { | 2975 void test_isSubtypeOf_positionalParameters_tHasMoreParams() { |
| 2658 ClassElement a = ElementFactory.classElement2("A", []); | 2976 ClassElement a = ElementFactory.classElement2("A", []); |
| 2659 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2977 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2660 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a, a]).type; | 2978 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a, a]).type; |
| 2661 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b]).type; | 2979 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b]).type; |
| 2662 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2980 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2663 } | 2981 } |
| 2982 |
| 2664 void test_isSubtypeOf_returnType_sIsVoid() { | 2983 void test_isSubtypeOf_returnType_sIsVoid() { |
| 2665 FunctionType t = ElementFactory.functionElement("t").type; | 2984 FunctionType t = ElementFactory.functionElement("t").type; |
| 2666 FunctionType s = ElementFactory.functionElement("s").type; | 2985 FunctionType s = ElementFactory.functionElement("s").type; |
| 2667 JUnitTestCase.assertTrue(VoidTypeImpl.instance == s.returnType); | 2986 JUnitTestCase.assertTrue(VoidTypeImpl.instance == s.returnType); |
| 2668 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2987 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2669 } | 2988 } |
| 2989 |
| 2670 void test_isSubtypeOf_returnType_tAssignableToS() { | 2990 void test_isSubtypeOf_returnType_tAssignableToS() { |
| 2671 ClassElement a = ElementFactory.classElement2("A", []); | 2991 ClassElement a = ElementFactory.classElement2("A", []); |
| 2672 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2992 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 2673 FunctionType t = ElementFactory.functionElement2("t", a).type; | 2993 FunctionType t = ElementFactory.functionElement2("t", a).type; |
| 2674 FunctionType s = ElementFactory.functionElement2("s", b).type; | 2994 FunctionType s = ElementFactory.functionElement2("s", b).type; |
| 2675 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2995 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2676 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); | 2996 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); |
| 2677 } | 2997 } |
| 2998 |
| 2678 void test_isSubtypeOf_returnType_tNotAssignableToS() { | 2999 void test_isSubtypeOf_returnType_tNotAssignableToS() { |
| 2679 FunctionType t = ElementFactory.functionElement2("t", ElementFactory.classEl
ement2("A", [])).type; | 3000 FunctionType t = ElementFactory.functionElement2("t", ElementFactory.classEl
ement2("A", [])).type; |
| 2680 FunctionType s = ElementFactory.functionElement2("s", ElementFactory.classEl
ement2("B", [])).type; | 3001 FunctionType s = ElementFactory.functionElement2("s", ElementFactory.classEl
ement2("B", [])).type; |
| 2681 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3002 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2682 } | 3003 } |
| 3004 |
| 2683 void test_isSubtypeOf_typeParameters_matchesBounds() { | 3005 void test_isSubtypeOf_typeParameters_matchesBounds() { |
| 2684 TestTypeProvider provider = new TestTypeProvider(); | 3006 TestTypeProvider provider = new TestTypeProvider(); |
| 2685 InterfaceType boolType = provider.boolType; | 3007 InterfaceType boolType = provider.boolType; |
| 2686 InterfaceType stringType = provider.stringType; | 3008 InterfaceType stringType = provider.stringType; |
| 2687 TypeParameterElementImpl parameterB = new TypeParameterElementImpl(ASTFactor
y.identifier3("B")); | 3009 TypeParameterElementImpl parameterB = new TypeParameterElementImpl(ASTFactor
y.identifier3("B")); |
| 2688 parameterB.bound = boolType; | 3010 parameterB.bound = boolType; |
| 2689 TypeParameterTypeImpl typeB = new TypeParameterTypeImpl(parameterB); | 3011 TypeParameterTypeImpl typeB = new TypeParameterTypeImpl(parameterB); |
| 2690 TypeParameterElementImpl parameterS = new TypeParameterElementImpl(ASTFactor
y.identifier3("S")); | 3012 TypeParameterElementImpl parameterS = new TypeParameterElementImpl(ASTFactor
y.identifier3("S")); |
| 2691 parameterS.bound = stringType; | 3013 parameterS.bound = stringType; |
| 2692 TypeParameterTypeImpl typeS = new TypeParameterTypeImpl(parameterS); | 3014 TypeParameterTypeImpl typeS = new TypeParameterTypeImpl(parameterS); |
| 2693 FunctionElementImpl functionAliasElement = new FunctionElementImpl.con1(ASTF
actory.identifier3("func")); | 3015 FunctionElementImpl functionAliasElement = new FunctionElementImpl.con1(ASTF
actory.identifier3("func")); |
| 2694 functionAliasElement.parameters = <ParameterElement> [ | 3016 functionAliasElement.parameters = <ParameterElement> [ |
| 2695 ElementFactory.requiredParameter2("a", typeB), | 3017 ElementFactory.requiredParameter2("a", typeB), |
| 2696 ElementFactory.positionalParameter2("b", typeS)]; | 3018 ElementFactory.positionalParameter2("b", typeS)]; |
| 2697 functionAliasElement.returnType = stringType; | 3019 functionAliasElement.returnType = stringType; |
| 2698 FunctionTypeImpl functionAliasType = new FunctionTypeImpl.con1(functionAlias
Element); | 3020 FunctionTypeImpl functionAliasType = new FunctionTypeImpl.con1(functionAlias
Element); |
| 2699 functionAliasElement.type = functionAliasType; | 3021 functionAliasElement.type = functionAliasType; |
| 2700 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3("f")); | 3022 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3("f")); |
| 2701 functionElement.parameters = <ParameterElement> [ | 3023 functionElement.parameters = <ParameterElement> [ |
| 2702 ElementFactory.requiredParameter2("c", boolType), | 3024 ElementFactory.requiredParameter2("c", boolType), |
| 2703 ElementFactory.positionalParameter2("d", stringType)]; | 3025 ElementFactory.positionalParameter2("d", stringType)]; |
| 2704 functionElement.returnType = provider.dynamicType; | 3026 functionElement.returnType = provider.dynamicType; |
| 2705 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 3027 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 2706 functionElement.type = functionType; | 3028 functionElement.type = functionType; |
| 2707 JUnitTestCase.assertTrue(functionType.isAssignableTo(functionAliasType)); | 3029 JUnitTestCase.assertTrue(functionType.isAssignableTo(functionAliasType)); |
| 2708 } | 3030 } |
| 3031 |
| 2709 void test_isSubtypeOf_wrongFunctionType_normal_named() { | 3032 void test_isSubtypeOf_wrongFunctionType_normal_named() { |
| 2710 ClassElement a = ElementFactory.classElement2("A", []); | 3033 ClassElement a = ElementFactory.classElement2("A", []); |
| 2711 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; | 3034 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; |
| 2712 FunctionType s = ElementFactory.functionElement7("s", null, <String> ["name"
], <ClassElement> [a]).type; | 3035 FunctionType s = ElementFactory.functionElement7("s", null, <String> ["name"
], <ClassElement> [a]).type; |
| 2713 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3036 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2714 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 3037 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 2715 } | 3038 } |
| 3039 |
| 2716 void test_isSubtypeOf_wrongFunctionType_optional_named() { | 3040 void test_isSubtypeOf_wrongFunctionType_optional_named() { |
| 2717 ClassElement a = ElementFactory.classElement2("A", []); | 3041 ClassElement a = ElementFactory.classElement2("A", []); |
| 2718 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 3042 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 2719 FunctionType s = ElementFactory.functionElement7("s", null, <String> ["name"
], <ClassElement> [a]).type; | 3043 FunctionType s = ElementFactory.functionElement7("s", null, <String> ["name"
], <ClassElement> [a]).type; |
| 2720 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3044 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 2721 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 3045 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 2722 } | 3046 } |
| 3047 |
| 2723 void test_setTypeArguments() { | 3048 void test_setTypeArguments() { |
| 2724 ClassElementImpl enclosingClass = ElementFactory.classElement2("C", ["E"]); | 3049 ClassElementImpl enclosingClass = ElementFactory.classElement2("C", ["E"]); |
| 2725 MethodElementImpl methodElement = new MethodElementImpl.con1(ASTFactory.iden
tifier3("m")); | 3050 MethodElementImpl methodElement = new MethodElementImpl.con1(ASTFactory.iden
tifier3("m")); |
| 2726 enclosingClass.methods = <MethodElement> [methodElement]; | 3051 enclosingClass.methods = <MethodElement> [methodElement]; |
| 2727 FunctionTypeImpl type = new FunctionTypeImpl.con1(methodElement); | 3052 FunctionTypeImpl type = new FunctionTypeImpl.con1(methodElement); |
| 2728 Type2 expectedType = enclosingClass.typeParameters[0].type; | 3053 Type2 expectedType = enclosingClass.typeParameters[0].type; |
| 2729 type.typeArguments = <Type2> [expectedType]; | 3054 type.typeArguments = <Type2> [expectedType]; |
| 2730 List<Type2> arguments = type.typeArguments; | 3055 List<Type2> arguments = type.typeArguments; |
| 2731 EngineTestCase.assertLength(1, arguments); | 3056 EngineTestCase.assertLength(1, arguments); |
| 2732 JUnitTestCase.assertEquals(expectedType, arguments[0]); | 3057 JUnitTestCase.assertEquals(expectedType, arguments[0]); |
| 2733 } | 3058 } |
| 3059 |
| 2734 void test_substitute2_equal() { | 3060 void test_substitute2_equal() { |
| 2735 ClassElementImpl definingClass = ElementFactory.classElement2("C", ["E"]); | 3061 ClassElementImpl definingClass = ElementFactory.classElement2("C", ["E"]); |
| 2736 TypeParameterType parameterType = definingClass.typeParameters[0].type; | 3062 TypeParameterType parameterType = definingClass.typeParameters[0].type; |
| 2737 MethodElementImpl functionElement = new MethodElementImpl.con1(ASTFactory.id
entifier3("m")); | 3063 MethodElementImpl functionElement = new MethodElementImpl.con1(ASTFactory.id
entifier3("m")); |
| 2738 String namedParameterName = "c"; | 3064 String namedParameterName = "c"; |
| 2739 functionElement.parameters = <ParameterElement> [ | 3065 functionElement.parameters = <ParameterElement> [ |
| 2740 ElementFactory.requiredParameter2("a", parameterType), | 3066 ElementFactory.requiredParameter2("a", parameterType), |
| 2741 ElementFactory.positionalParameter2("b", parameterType), | 3067 ElementFactory.positionalParameter2("b", parameterType), |
| 2742 ElementFactory.namedParameter2(namedParameterName, parameterType)]; | 3068 ElementFactory.namedParameter2(namedParameterName, parameterType)]; |
| 2743 functionElement.returnType = parameterType; | 3069 functionElement.returnType = parameterType; |
| 2744 definingClass.methods = <MethodElement> [functionElement]; | 3070 definingClass.methods = <MethodElement> [functionElement]; |
| 2745 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 3071 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 2746 functionType.typeArguments = <Type2> [parameterType]; | 3072 functionType.typeArguments = <Type2> [parameterType]; |
| 2747 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(ASTFactory.identifier3("D"))); | 3073 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(ASTFactory.identifier3("D"))); |
| 2748 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); | 3074 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); |
| 2749 JUnitTestCase.assertEquals(argumentType, result.returnType); | 3075 JUnitTestCase.assertEquals(argumentType, result.returnType); |
| 2750 List<Type2> normalParameters = result.normalParameterTypes; | 3076 List<Type2> normalParameters = result.normalParameterTypes; |
| 2751 EngineTestCase.assertLength(1, normalParameters); | 3077 EngineTestCase.assertLength(1, normalParameters); |
| 2752 JUnitTestCase.assertEquals(argumentType, normalParameters[0]); | 3078 JUnitTestCase.assertEquals(argumentType, normalParameters[0]); |
| 2753 List<Type2> optionalParameters = result.optionalParameterTypes; | 3079 List<Type2> optionalParameters = result.optionalParameterTypes; |
| 2754 EngineTestCase.assertLength(1, optionalParameters); | 3080 EngineTestCase.assertLength(1, optionalParameters); |
| 2755 JUnitTestCase.assertEquals(argumentType, optionalParameters[0]); | 3081 JUnitTestCase.assertEquals(argumentType, optionalParameters[0]); |
| 2756 Map<String, Type2> namedParameters = result.namedParameterTypes; | 3082 Map<String, Type2> namedParameters = result.namedParameterTypes; |
| 2757 EngineTestCase.assertSize2(1, namedParameters); | 3083 EngineTestCase.assertSize2(1, namedParameters); |
| 2758 JUnitTestCase.assertEquals(argumentType, namedParameters[namedParameterName]
); | 3084 JUnitTestCase.assertEquals(argumentType, namedParameters[namedParameterName]
); |
| 2759 } | 3085 } |
| 3086 |
| 2760 void test_substitute2_notEqual() { | 3087 void test_substitute2_notEqual() { |
| 2761 Type2 returnType = new InterfaceTypeImpl.con1(new ClassElementImpl(ASTFactor
y.identifier3("R"))); | 3088 Type2 returnType = new InterfaceTypeImpl.con1(new ClassElementImpl(ASTFactor
y.identifier3("R"))); |
| 2762 Type2 normalParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(
ASTFactory.identifier3("A"))); | 3089 Type2 normalParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(
ASTFactory.identifier3("A"))); |
| 2763 Type2 optionalParameterType = new InterfaceTypeImpl.con1(new ClassElementImp
l(ASTFactory.identifier3("B"))); | 3090 Type2 optionalParameterType = new InterfaceTypeImpl.con1(new ClassElementImp
l(ASTFactory.identifier3("B"))); |
| 2764 Type2 namedParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(A
STFactory.identifier3("C"))); | 3091 Type2 namedParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(A
STFactory.identifier3("C"))); |
| 2765 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3("f")); | 3092 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3("f")); |
| 2766 String namedParameterName = "c"; | 3093 String namedParameterName = "c"; |
| 2767 functionElement.parameters = <ParameterElement> [ | 3094 functionElement.parameters = <ParameterElement> [ |
| 2768 ElementFactory.requiredParameter2("a", normalParameterType), | 3095 ElementFactory.requiredParameter2("a", normalParameterType), |
| 2769 ElementFactory.positionalParameter2("b", optionalParameterType), | 3096 ElementFactory.positionalParameter2("b", optionalParameterType), |
| 2770 ElementFactory.namedParameter2(namedParameterName, namedParameterType)]; | 3097 ElementFactory.namedParameter2(namedParameterName, namedParameterType)]; |
| 2771 functionElement.returnType = returnType; | 3098 functionElement.returnType = returnType; |
| 2772 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 3099 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 2773 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(ASTFactory.identifier3("D"))); | 3100 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(ASTFactory.identifier3("D"))); |
| 2774 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(new TypePara
meterElementImpl(ASTFactory.identifier3("E"))); | 3101 TypeParameterTypeImpl parameterType = new TypeParameterTypeImpl(new TypePara
meterElementImpl(ASTFactory.identifier3("E"))); |
| 2775 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); | 3102 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); |
| 2776 JUnitTestCase.assertEquals(returnType, result.returnType); | 3103 JUnitTestCase.assertEquals(returnType, result.returnType); |
| 2777 List<Type2> normalParameters = result.normalParameterTypes; | 3104 List<Type2> normalParameters = result.normalParameterTypes; |
| 2778 EngineTestCase.assertLength(1, normalParameters); | 3105 EngineTestCase.assertLength(1, normalParameters); |
| 2779 JUnitTestCase.assertEquals(normalParameterType, normalParameters[0]); | 3106 JUnitTestCase.assertEquals(normalParameterType, normalParameters[0]); |
| 2780 List<Type2> optionalParameters = result.optionalParameterTypes; | 3107 List<Type2> optionalParameters = result.optionalParameterTypes; |
| 2781 EngineTestCase.assertLength(1, optionalParameters); | 3108 EngineTestCase.assertLength(1, optionalParameters); |
| 2782 JUnitTestCase.assertEquals(optionalParameterType, optionalParameters[0]); | 3109 JUnitTestCase.assertEquals(optionalParameterType, optionalParameters[0]); |
| 2783 Map<String, Type2> namedParameters = result.namedParameterTypes; | 3110 Map<String, Type2> namedParameters = result.namedParameterTypes; |
| 2784 EngineTestCase.assertSize2(1, namedParameters); | 3111 EngineTestCase.assertSize2(1, namedParameters); |
| 2785 JUnitTestCase.assertEquals(namedParameterType, namedParameters[namedParamete
rName]); | 3112 JUnitTestCase.assertEquals(namedParameterType, namedParameters[namedParamete
rName]); |
| 2786 } | 3113 } |
| 3114 |
| 2787 static dartSuite() { | 3115 static dartSuite() { |
| 2788 _ut.group('FunctionTypeImplTest', () { | 3116 _ut.group('FunctionTypeImplTest', () { |
| 2789 _ut.test('test_creation', () { | 3117 _ut.test('test_creation', () { |
| 2790 final __test = new FunctionTypeImplTest(); | 3118 final __test = new FunctionTypeImplTest(); |
| 2791 runJUnitTest(__test, __test.test_creation); | 3119 runJUnitTest(__test, __test.test_creation); |
| 2792 }); | 3120 }); |
| 2793 _ut.test('test_getElement', () { | 3121 _ut.test('test_getElement', () { |
| 2794 final __test = new FunctionTypeImplTest(); | 3122 final __test = new FunctionTypeImplTest(); |
| 2795 runJUnitTest(__test, __test.test_getElement); | 3123 runJUnitTest(__test, __test.test_getElement); |
| 2796 }); | 3124 }); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2954 final __test = new FunctionTypeImplTest(); | 3282 final __test = new FunctionTypeImplTest(); |
| 2955 runJUnitTest(__test, __test.test_substitute2_equal); | 3283 runJUnitTest(__test, __test.test_substitute2_equal); |
| 2956 }); | 3284 }); |
| 2957 _ut.test('test_substitute2_notEqual', () { | 3285 _ut.test('test_substitute2_notEqual', () { |
| 2958 final __test = new FunctionTypeImplTest(); | 3286 final __test = new FunctionTypeImplTest(); |
| 2959 runJUnitTest(__test, __test.test_substitute2_notEqual); | 3287 runJUnitTest(__test, __test.test_substitute2_notEqual); |
| 2960 }); | 3288 }); |
| 2961 }); | 3289 }); |
| 2962 } | 3290 } |
| 2963 } | 3291 } |
| 2964 class InterfaceTypeImpl_23 extends InterfaceTypeImpl { | 3292 |
| 2965 InterfaceTypeImpl_23(ClassElement arg0) : super.con1(arg0); | 3293 class InterfaceTypeImpl_24 extends InterfaceTypeImpl { |
| 3294 InterfaceTypeImpl_24(ClassElement arg0) : super.con1(arg0); |
| 3295 |
| 2966 bool get isDartCoreFunction => true; | 3296 bool get isDartCoreFunction => true; |
| 2967 } | 3297 } |
| 3298 |
| 2968 main() { | 3299 main() { |
| 2969 ElementKindTest.dartSuite(); | 3300 ElementKindTest.dartSuite(); |
| 2970 FunctionTypeImplTest.dartSuite(); | 3301 FunctionTypeImplTest.dartSuite(); |
| 2971 InterfaceTypeImplTest.dartSuite(); | 3302 InterfaceTypeImplTest.dartSuite(); |
| 2972 TypeParameterTypeImplTest.dartSuite(); | 3303 TypeParameterTypeImplTest.dartSuite(); |
| 3304 VoidTypeImplTest.dartSuite(); |
| 2973 ClassElementImplTest.dartSuite(); | 3305 ClassElementImplTest.dartSuite(); |
| 2974 ElementLocationImplTest.dartSuite(); | 3306 ElementLocationImplTest.dartSuite(); |
| 2975 ElementImplTest.dartSuite(); | 3307 ElementImplTest.dartSuite(); |
| 2976 LibraryElementImplTest.dartSuite(); | 3308 LibraryElementImplTest.dartSuite(); |
| 2977 MultiplyDefinedElementImplTest.dartSuite(); | 3309 MultiplyDefinedElementImplTest.dartSuite(); |
| 2978 } | 3310 } |
| OLD | NEW |