| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.element_test; | 3 library engine.element_test; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 6 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 7 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; | 8 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 9 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/source_io.dart'; | 10 import 'package:analyzer_experimental/src/generated/source_io.dart'; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 JUnitTestCase.assertNotNull(new LibraryElementImpl(createAnalysisContext(),
ASTFactory.libraryIdentifier2(["l"]))); | 106 JUnitTestCase.assertNotNull(new LibraryElementImpl(createAnalysisContext(),
ASTFactory.libraryIdentifier2(["l"]))); |
| 107 } | 107 } |
| 108 void test_getImportedLibraries() { | 108 void test_getImportedLibraries() { |
| 109 AnalysisContext context = createAnalysisContext(); | 109 AnalysisContext context = createAnalysisContext(); |
| 110 LibraryElementImpl library1 = ElementFactory.library(context, "l1"); | 110 LibraryElementImpl library1 = ElementFactory.library(context, "l1"); |
| 111 LibraryElementImpl library2 = ElementFactory.library(context, "l2"); | 111 LibraryElementImpl library2 = ElementFactory.library(context, "l2"); |
| 112 LibraryElementImpl library3 = ElementFactory.library(context, "l3"); | 112 LibraryElementImpl library3 = ElementFactory.library(context, "l3"); |
| 113 LibraryElementImpl library4 = ElementFactory.library(context, "l4"); | 113 LibraryElementImpl library4 = ElementFactory.library(context, "l4"); |
| 114 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); | 114 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); |
| 115 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); | 115 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); |
| 116 List<ImportElementImpl> imports = [ElementFactory.importFor(library2, null,
[]), ElementFactory.importFor(library2, prefixB, []), ElementFactory.importFor(l
ibrary3, null, []), ElementFactory.importFor(library3, prefixA, []), ElementFact
ory.importFor(library3, prefixB, []), ElementFactory.importFor(library4, prefixA
, [])]; | 116 List<ImportElementImpl> imports = [ |
| 117 ElementFactory.importFor(library2, null, []), |
| 118 ElementFactory.importFor(library2, prefixB, []), |
| 119 ElementFactory.importFor(library3, null, []), |
| 120 ElementFactory.importFor(library3, prefixA, []), |
| 121 ElementFactory.importFor(library3, prefixB, []), |
| 122 ElementFactory.importFor(library4, prefixA, [])]; |
| 117 library1.imports = imports; | 123 library1.imports = imports; |
| 118 List<LibraryElement> libraries = library1.importedLibraries; | 124 List<LibraryElement> libraries = library1.importedLibraries; |
| 119 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library2, library3,
library4], libraries); | 125 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library2, library3,
library4], libraries); |
| 120 } | 126 } |
| 121 void test_getPrefixes() { | 127 void test_getPrefixes() { |
| 122 AnalysisContext context = createAnalysisContext(); | 128 AnalysisContext context = createAnalysisContext(); |
| 123 LibraryElementImpl library = ElementFactory.library(context, "l1"); | 129 LibraryElementImpl library = ElementFactory.library(context, "l1"); |
| 124 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); | 130 PrefixElement prefixA = new PrefixElementImpl(ASTFactory.identifier3("a")); |
| 125 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); | 131 PrefixElement prefixB = new PrefixElementImpl(ASTFactory.identifier3("b")); |
| 126 List<ImportElementImpl> imports = [ElementFactory.importFor(ElementFactory.l
ibrary(context, "l2"), null, []), ElementFactory.importFor(ElementFactory.librar
y(context, "l3"), null, []), ElementFactory.importFor(ElementFactory.library(con
text, "l4"), prefixA, []), ElementFactory.importFor(ElementFactory.library(conte
xt, "l5"), prefixA, []), ElementFactory.importFor(ElementFactory.library(context
, "l6"), prefixB, [])]; | 132 List<ImportElementImpl> imports = [ |
| 133 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), |
| 134 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
), |
| 135 ElementFactory.importFor(ElementFactory.library(context, "l4"), prefixA,
[]), |
| 136 ElementFactory.importFor(ElementFactory.library(context, "l5"), prefixA,
[]), |
| 137 ElementFactory.importFor(ElementFactory.library(context, "l6"), prefixB,
[])]; |
| 127 library.imports = imports; | 138 library.imports = imports; |
| 128 List<PrefixElement> prefixes = library.prefixes; | 139 List<PrefixElement> prefixes = library.prefixes; |
| 129 EngineTestCase.assertLength(2, prefixes); | 140 EngineTestCase.assertLength(2, prefixes); |
| 130 if (identical(prefixA, prefixes[0])) { | 141 if (identical(prefixA, prefixes[0])) { |
| 131 JUnitTestCase.assertSame(prefixB, prefixes[1]); | 142 JUnitTestCase.assertSame(prefixB, prefixes[1]); |
| 132 } else { | 143 } else { |
| 133 JUnitTestCase.assertSame(prefixB, prefixes[0]); | 144 JUnitTestCase.assertSame(prefixB, prefixes[0]); |
| 134 JUnitTestCase.assertSame(prefixA, prefixes[1]); | 145 JUnitTestCase.assertSame(prefixA, prefixes[1]); |
| 135 } | 146 } |
| 136 } | 147 } |
| 137 void test_isUpToDate() { | 148 void test_isUpToDate() { |
| 138 AnalysisContext context = createAnalysisContext(); | 149 AnalysisContext context = createAnalysisContext(); |
| 139 context.sourceFactory = new SourceFactory.con2([]); | 150 context.sourceFactory = new SourceFactory.con2([]); |
| 140 LibraryElement library = ElementFactory.library(context, "foo"); | 151 LibraryElement library = ElementFactory.library(context, "foo"); |
| 141 context.sourceFactory.setContents(library.definingCompilationUnit.source, "s
dfsdff"); | 152 context.sourceFactory.setContents(library.definingCompilationUnit.source, "s
dfsdff"); |
| 142 JUnitTestCase.assertFalse(library.isUpToDate2(0)); | 153 JUnitTestCase.assertFalse(library.isUpToDate2(0)); |
| 143 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); | 154 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); |
| 144 } | 155 } |
| 145 void test_setImports() { | 156 void test_setImports() { |
| 146 AnalysisContext context = createAnalysisContext(); | 157 AnalysisContext context = createAnalysisContext(); |
| 147 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["l1"])); | 158 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["l1"])); |
| 148 List<ImportElementImpl> expectedImports = [ElementFactory.importFor(ElementF
actory.library(context, "l2"), null, []), ElementFactory.importFor(ElementFactor
y.library(context, "l3"), null, [])]; | 159 List<ImportElementImpl> expectedImports = [ |
| 160 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), |
| 161 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
)]; |
| 149 library.imports = expectedImports; | 162 library.imports = expectedImports; |
| 150 List<ImportElement> actualImports = library.imports; | 163 List<ImportElement> actualImports = library.imports; |
| 151 EngineTestCase.assertLength(expectedImports.length, actualImports); | 164 EngineTestCase.assertLength(expectedImports.length, actualImports); |
| 152 for (int i = 0; i < actualImports.length; i++) { | 165 for (int i = 0; i < actualImports.length; i++) { |
| 153 JUnitTestCase.assertSame(expectedImports[i], actualImports[i]); | 166 JUnitTestCase.assertSame(expectedImports[i], actualImports[i]); |
| 154 } | 167 } |
| 155 } | 168 } |
| 156 static dartSuite() { | 169 static dartSuite() { |
| 157 _ut.group('LibraryElementImplTest', () { | 170 _ut.group('LibraryElementImplTest', () { |
| 158 _ut.test('test_creation', () { | 171 _ut.test('test_creation', () { |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(functionType)); | 433 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(functionType)); |
| 421 } | 434 } |
| 422 void test_getLeastUpperBound_mixinCase() { | 435 void test_getLeastUpperBound_mixinCase() { |
| 423 ClassElement classA = ElementFactory.classElement2("A", []); | 436 ClassElement classA = ElementFactory.classElement2("A", []); |
| 424 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 437 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 425 ClassElement classC = ElementFactory.classElement("C", classA.type, []); | 438 ClassElement classC = ElementFactory.classElement("C", classA.type, []); |
| 426 ClassElementImpl classD = ElementFactory.classElement("D", classB.type, []); | 439 ClassElementImpl classD = ElementFactory.classElement("D", classB.type, []); |
| 427 InterfaceType typeA = classA.type; | 440 InterfaceType typeA = classA.type; |
| 428 InterfaceType typeC = classC.type; | 441 InterfaceType typeC = classC.type; |
| 429 InterfaceType typeD = classD.type; | 442 InterfaceType typeD = classD.type; |
| 430 classD.mixins = <InterfaceType> [ElementFactory.classElement2("M", []).type,
ElementFactory.classElement2("N", []).type, ElementFactory.classElement2("O", [
]).type, ElementFactory.classElement2("P", []).type]; | 443 classD.mixins = <InterfaceType> [ |
| 444 ElementFactory.classElement2("M", []).type, |
| 445 ElementFactory.classElement2("N", []).type, |
| 446 ElementFactory.classElement2("O", []).type, |
| 447 ElementFactory.classElement2("P", []).type]; |
| 431 JUnitTestCase.assertEquals(typeA, typeD.getLeastUpperBound(typeC)); | 448 JUnitTestCase.assertEquals(typeA, typeD.getLeastUpperBound(typeC)); |
| 432 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeD)); | 449 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeD)); |
| 433 } | 450 } |
| 434 void test_getLeastUpperBound_null() { | 451 void test_getLeastUpperBound_null() { |
| 435 Type2 interfaceType = ElementFactory.classElement2("A", []).type; | 452 Type2 interfaceType = ElementFactory.classElement2("A", []).type; |
| 436 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(null)); | 453 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(null)); |
| 437 } | 454 } |
| 438 void test_getLeastUpperBound_object() { | 455 void test_getLeastUpperBound_object() { |
| 439 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 456 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 440 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 457 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 void test_lookUpSetter_unimplemented() { | 1117 void test_lookUpSetter_unimplemented() { |
| 1101 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1118 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1102 InterfaceType typeA = classA.type; | 1119 InterfaceType typeA = classA.type; |
| 1103 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1120 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1104 CompilationUnitElement unit = library.definingCompilationUnit; | 1121 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1105 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1122 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; |
| 1106 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); | 1123 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); |
| 1107 } | 1124 } |
| 1108 void test_setTypeArguments() { | 1125 void test_setTypeArguments() { |
| 1109 InterfaceTypeImpl type = ElementFactory.classElement2("A", []).type as Inter
faceTypeImpl; | 1126 InterfaceTypeImpl type = ElementFactory.classElement2("A", []).type as Inter
faceTypeImpl; |
| 1110 List<Type2> typeArguments = <Type2> [ElementFactory.classElement2("B", []).t
ype, ElementFactory.classElement2("C", []).type]; | 1127 List<Type2> typeArguments = <Type2> [ |
| 1128 ElementFactory.classElement2("B", []).type, |
| 1129 ElementFactory.classElement2("C", []).type]; |
| 1111 type.typeArguments = typeArguments; | 1130 type.typeArguments = typeArguments; |
| 1112 JUnitTestCase.assertEquals(typeArguments, type.typeArguments); | 1131 JUnitTestCase.assertEquals(typeArguments, type.typeArguments); |
| 1113 } | 1132 } |
| 1114 void test_substitute_equal() { | 1133 void test_substitute_equal() { |
| 1115 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1134 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1116 TypeVariableElementImpl parameterElement = new TypeVariableElementImpl(ASTFa
ctory.identifier3("E")); | 1135 TypeVariableElementImpl parameterElement = new TypeVariableElementImpl(ASTFa
ctory.identifier3("E")); |
| 1117 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); | 1136 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(classA); |
| 1118 TypeVariableTypeImpl parameter = new TypeVariableTypeImpl(parameterElement); | 1137 TypeVariableTypeImpl parameter = new TypeVariableTypeImpl(parameterElement); |
| 1119 type.typeArguments = <Type2> [parameter]; | 1138 type.typeArguments = <Type2> [parameter]; |
| 1120 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; | 1139 InterfaceType argumentType = ElementFactory.classElement2("B", []).type; |
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2429 TestTypeProvider provider = new TestTypeProvider(); | 2448 TestTypeProvider provider = new TestTypeProvider(); |
| 2430 InterfaceType boolType = provider.boolType; | 2449 InterfaceType boolType = provider.boolType; |
| 2431 InterfaceType stringType = provider.stringType; | 2450 InterfaceType stringType = provider.stringType; |
| 2432 TypeVariableElementImpl variableB = new TypeVariableElementImpl(ASTFactory.i
dentifier3("B")); | 2451 TypeVariableElementImpl variableB = new TypeVariableElementImpl(ASTFactory.i
dentifier3("B")); |
| 2433 variableB.bound = boolType; | 2452 variableB.bound = boolType; |
| 2434 TypeVariableTypeImpl typeB = new TypeVariableTypeImpl(variableB); | 2453 TypeVariableTypeImpl typeB = new TypeVariableTypeImpl(variableB); |
| 2435 TypeVariableElementImpl variableS = new TypeVariableElementImpl(ASTFactory.i
dentifier3("S")); | 2454 TypeVariableElementImpl variableS = new TypeVariableElementImpl(ASTFactory.i
dentifier3("S")); |
| 2436 variableS.bound = stringType; | 2455 variableS.bound = stringType; |
| 2437 TypeVariableTypeImpl typeS = new TypeVariableTypeImpl(variableS); | 2456 TypeVariableTypeImpl typeS = new TypeVariableTypeImpl(variableS); |
| 2438 FunctionElementImpl functionAliasElement = new FunctionElementImpl.con1(ASTF
actory.identifier3("func")); | 2457 FunctionElementImpl functionAliasElement = new FunctionElementImpl.con1(ASTF
actory.identifier3("func")); |
| 2439 functionAliasElement.parameters = <ParameterElement> [ElementFactory.require
dParameter2("a", typeB), ElementFactory.positionalParameter2("b", typeS)]; | 2458 functionAliasElement.parameters = <ParameterElement> [ |
| 2459 ElementFactory.requiredParameter2("a", typeB), |
| 2460 ElementFactory.positionalParameter2("b", typeS)]; |
| 2440 functionAliasElement.returnType = stringType; | 2461 functionAliasElement.returnType = stringType; |
| 2441 FunctionTypeImpl functionAliasType = new FunctionTypeImpl.con1(functionAlias
Element); | 2462 FunctionTypeImpl functionAliasType = new FunctionTypeImpl.con1(functionAlias
Element); |
| 2442 functionAliasElement.type = functionAliasType; | 2463 functionAliasElement.type = functionAliasType; |
| 2443 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3("f")); | 2464 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3("f")); |
| 2444 functionElement.parameters = <ParameterElement> [ElementFactory.requiredPara
meter2("c", boolType), ElementFactory.positionalParameter2("d", stringType)]; | 2465 functionElement.parameters = <ParameterElement> [ |
| 2466 ElementFactory.requiredParameter2("c", boolType), |
| 2467 ElementFactory.positionalParameter2("d", stringType)]; |
| 2445 functionElement.returnType = provider.dynamicType; | 2468 functionElement.returnType = provider.dynamicType; |
| 2446 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 2469 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 2447 functionElement.type = functionType; | 2470 functionElement.type = functionType; |
| 2448 JUnitTestCase.assertTrue(functionType.isAssignableTo(functionAliasType)); | 2471 JUnitTestCase.assertTrue(functionType.isAssignableTo(functionAliasType)); |
| 2449 } | 2472 } |
| 2450 void test_isSubtypeOf_wrongFunctionType_normal_named() { | 2473 void test_isSubtypeOf_wrongFunctionType_normal_named() { |
| 2451 ClassElement a = ElementFactory.classElement2("A", []); | 2474 ClassElement a = ElementFactory.classElement2("A", []); |
| 2452 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; | 2475 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; |
| 2453 FunctionType s = ElementFactory.functionElement7("s", null, <String> ["name"
], <ClassElement> [a]).type; | 2476 FunctionType s = ElementFactory.functionElement7("s", null, <String> ["name"
], <ClassElement> [a]).type; |
| 2454 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2477 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2470 type.typeArguments = <Type2> [expectedType]; | 2493 type.typeArguments = <Type2> [expectedType]; |
| 2471 List<Type2> arguments = type.typeArguments; | 2494 List<Type2> arguments = type.typeArguments; |
| 2472 EngineTestCase.assertLength(1, arguments); | 2495 EngineTestCase.assertLength(1, arguments); |
| 2473 JUnitTestCase.assertEquals(expectedType, arguments[0]); | 2496 JUnitTestCase.assertEquals(expectedType, arguments[0]); |
| 2474 } | 2497 } |
| 2475 void test_substitute2_equal() { | 2498 void test_substitute2_equal() { |
| 2476 ClassElementImpl definingClass = ElementFactory.classElement2("C", ["E"]); | 2499 ClassElementImpl definingClass = ElementFactory.classElement2("C", ["E"]); |
| 2477 TypeVariableType parameterType = definingClass.typeVariables[0].type; | 2500 TypeVariableType parameterType = definingClass.typeVariables[0].type; |
| 2478 MethodElementImpl functionElement = new MethodElementImpl.con1(ASTFactory.id
entifier3("m")); | 2501 MethodElementImpl functionElement = new MethodElementImpl.con1(ASTFactory.id
entifier3("m")); |
| 2479 String namedParameterName = "c"; | 2502 String namedParameterName = "c"; |
| 2480 functionElement.parameters = <ParameterElement> [ElementFactory.requiredPara
meter2("a", parameterType), ElementFactory.positionalParameter2("b", parameterTy
pe), ElementFactory.namedParameter2(namedParameterName, parameterType)]; | 2503 functionElement.parameters = <ParameterElement> [ |
| 2504 ElementFactory.requiredParameter2("a", parameterType), |
| 2505 ElementFactory.positionalParameter2("b", parameterType), |
| 2506 ElementFactory.namedParameter2(namedParameterName, parameterType)]; |
| 2481 functionElement.returnType = parameterType; | 2507 functionElement.returnType = parameterType; |
| 2482 definingClass.methods = <MethodElement> [functionElement]; | 2508 definingClass.methods = <MethodElement> [functionElement]; |
| 2483 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 2509 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 2484 functionType.typeArguments = <Type2> [parameterType]; | 2510 functionType.typeArguments = <Type2> [parameterType]; |
| 2485 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(ASTFactory.identifier3("D"))); | 2511 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(ASTFactory.identifier3("D"))); |
| 2486 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); | 2512 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); |
| 2487 JUnitTestCase.assertEquals(argumentType, result.returnType); | 2513 JUnitTestCase.assertEquals(argumentType, result.returnType); |
| 2488 List<Type2> normalParameters = result.normalParameterTypes; | 2514 List<Type2> normalParameters = result.normalParameterTypes; |
| 2489 EngineTestCase.assertLength(1, normalParameters); | 2515 EngineTestCase.assertLength(1, normalParameters); |
| 2490 JUnitTestCase.assertEquals(argumentType, normalParameters[0]); | 2516 JUnitTestCase.assertEquals(argumentType, normalParameters[0]); |
| 2491 List<Type2> optionalParameters = result.optionalParameterTypes; | 2517 List<Type2> optionalParameters = result.optionalParameterTypes; |
| 2492 EngineTestCase.assertLength(1, optionalParameters); | 2518 EngineTestCase.assertLength(1, optionalParameters); |
| 2493 JUnitTestCase.assertEquals(argumentType, optionalParameters[0]); | 2519 JUnitTestCase.assertEquals(argumentType, optionalParameters[0]); |
| 2494 Map<String, Type2> namedParameters = result.namedParameterTypes; | 2520 Map<String, Type2> namedParameters = result.namedParameterTypes; |
| 2495 EngineTestCase.assertSize2(1, namedParameters); | 2521 EngineTestCase.assertSize2(1, namedParameters); |
| 2496 JUnitTestCase.assertEquals(argumentType, namedParameters[namedParameterName]
); | 2522 JUnitTestCase.assertEquals(argumentType, namedParameters[namedParameterName]
); |
| 2497 } | 2523 } |
| 2498 void test_substitute2_notEqual() { | 2524 void test_substitute2_notEqual() { |
| 2499 Type2 returnType = new InterfaceTypeImpl.con1(new ClassElementImpl(ASTFactor
y.identifier3("R"))); | 2525 Type2 returnType = new InterfaceTypeImpl.con1(new ClassElementImpl(ASTFactor
y.identifier3("R"))); |
| 2500 Type2 normalParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(
ASTFactory.identifier3("A"))); | 2526 Type2 normalParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(
ASTFactory.identifier3("A"))); |
| 2501 Type2 optionalParameterType = new InterfaceTypeImpl.con1(new ClassElementImp
l(ASTFactory.identifier3("B"))); | 2527 Type2 optionalParameterType = new InterfaceTypeImpl.con1(new ClassElementImp
l(ASTFactory.identifier3("B"))); |
| 2502 Type2 namedParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(A
STFactory.identifier3("C"))); | 2528 Type2 namedParameterType = new InterfaceTypeImpl.con1(new ClassElementImpl(A
STFactory.identifier3("C"))); |
| 2503 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3("f")); | 2529 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3("f")); |
| 2504 String namedParameterName = "c"; | 2530 String namedParameterName = "c"; |
| 2505 functionElement.parameters = <ParameterElement> [ElementFactory.requiredPara
meter2("a", normalParameterType), ElementFactory.positionalParameter2("b", optio
nalParameterType), ElementFactory.namedParameter2(namedParameterName, namedParam
eterType)]; | 2531 functionElement.parameters = <ParameterElement> [ |
| 2532 ElementFactory.requiredParameter2("a", normalParameterType), |
| 2533 ElementFactory.positionalParameter2("b", optionalParameterType), |
| 2534 ElementFactory.namedParameter2(namedParameterName, namedParameterType)]; |
| 2506 functionElement.returnType = returnType; | 2535 functionElement.returnType = returnType; |
| 2507 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 2536 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 2508 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(ASTFactory.identifier3("D"))); | 2537 InterfaceTypeImpl argumentType = new InterfaceTypeImpl.con1(new ClassElement
Impl(ASTFactory.identifier3("D"))); |
| 2509 TypeVariableTypeImpl parameterType = new TypeVariableTypeImpl(new TypeVariab
leElementImpl(ASTFactory.identifier3("E"))); | 2538 TypeVariableTypeImpl parameterType = new TypeVariableTypeImpl(new TypeVariab
leElementImpl(ASTFactory.identifier3("E"))); |
| 2510 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); | 2539 FunctionType result = functionType.substitute2(<Type2> [argumentType], <Type
2> [parameterType]); |
| 2511 JUnitTestCase.assertEquals(returnType, result.returnType); | 2540 JUnitTestCase.assertEquals(returnType, result.returnType); |
| 2512 List<Type2> normalParameters = result.normalParameterTypes; | 2541 List<Type2> normalParameters = result.normalParameterTypes; |
| 2513 EngineTestCase.assertLength(1, normalParameters); | 2542 EngineTestCase.assertLength(1, normalParameters); |
| 2514 JUnitTestCase.assertEquals(normalParameterType, normalParameters[0]); | 2543 JUnitTestCase.assertEquals(normalParameterType, normalParameters[0]); |
| 2515 List<Type2> optionalParameters = result.optionalParameterTypes; | 2544 List<Type2> optionalParameters = result.optionalParameterTypes; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2699 main() { | 2728 main() { |
| 2700 ElementKindTest.dartSuite(); | 2729 ElementKindTest.dartSuite(); |
| 2701 FunctionTypeImplTest.dartSuite(); | 2730 FunctionTypeImplTest.dartSuite(); |
| 2702 InterfaceTypeImplTest.dartSuite(); | 2731 InterfaceTypeImplTest.dartSuite(); |
| 2703 TypeVariableTypeImplTest.dartSuite(); | 2732 TypeVariableTypeImplTest.dartSuite(); |
| 2704 ClassElementImplTest.dartSuite(); | 2733 ClassElementImplTest.dartSuite(); |
| 2705 ElementLocationImplTest.dartSuite(); | 2734 ElementLocationImplTest.dartSuite(); |
| 2706 ElementImplTest.dartSuite(); | 2735 ElementImplTest.dartSuite(); |
| 2707 LibraryElementImplTest.dartSuite(); | 2736 LibraryElementImplTest.dartSuite(); |
| 2708 } | 2737 } |
| OLD | NEW |