Index: tests/compiler/dart2js/simple_inferrer_test.dart |
diff --git a/tests/compiler/dart2js/simple_inferrer_test.dart b/tests/compiler/dart2js/simple_inferrer_test.dart |
index 000bcd28cacb1fae46da3884f08a821a6ca981ef..499f1546bb1c3606a81bf11c75e6743cef8a5477 100644 |
--- a/tests/compiler/dart2js/simple_inferrer_test.dart |
+++ b/tests/compiler/dart2js/simple_inferrer_test.dart |
@@ -484,107 +484,109 @@ main() { |
void main() { |
Uri uri = new Uri(scheme: 'source'); |
var compiler = compilerFor(TEST, uri); |
- compiler.runCompiler(uri); |
- var typesInferrer = compiler.typesTask.typesInferrer; |
- |
- checkReturn(String name, type) { |
- var element = findElement(compiler, name); |
- Expect.equals( |
- type, |
- typesInferrer.internal.returnTypeOf[element].simplify(compiler), |
- name); |
- } |
- var interceptorType = |
- findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); |
- |
- checkReturn('returnNum1', typesInferrer.numType); |
- checkReturn('returnNum2', typesInferrer.numType); |
- checkReturn('returnInt1', typesInferrer.intType); |
- checkReturn('returnInt2', typesInferrer.intType); |
- checkReturn('returnDouble', typesInferrer.doubleType); |
- checkReturn('returnGiveUp', interceptorType); |
- checkReturn('returnInt5', typesInferrer.intType); |
- checkReturn('returnInt6', typesInferrer.intType); |
- checkReturn('returnIntOrNull', typesInferrer.intType.nullable()); |
- checkReturn('returnInt3', typesInferrer.intType); |
- checkReturn('returnDynamic', typesInferrer.dynamicType); |
- checkReturn('returnInt4', typesInferrer.intType); |
- checkReturn('returnInt7', typesInferrer.intType); |
- checkReturn('returnInt8', typesInferrer.intType); |
- checkReturn('returnDynamic1', typesInferrer.dynamicType); |
- checkReturn('returnDynamic2', typesInferrer.dynamicType); |
- TypeMask intType = new TypeMask.nonNullSubtype(compiler.intClass.rawType); |
- checkReturn('testIsCheck1', intType); |
- checkReturn('testIsCheck2', intType); |
- checkReturn('testIsCheck3', intType.nullable()); |
- checkReturn('testIsCheck4', intType); |
- checkReturn('testIsCheck5', intType); |
- checkReturn('testIsCheck6', typesInferrer.dynamicType); |
- checkReturn('testIsCheck7', intType); |
- checkReturn('testIsCheck8', typesInferrer.dynamicType); |
- checkReturn('testIsCheck9', intType); |
- checkReturn('testIsCheck10', typesInferrer.dynamicType); |
- checkReturn('testIsCheck11', intType); |
- checkReturn('testIsCheck12', typesInferrer.dynamicType); |
- checkReturn('testIsCheck13', intType); |
- checkReturn('testIsCheck14', typesInferrer.dynamicType); |
- checkReturn('testIsCheck15', intType); |
- checkReturn('testIsCheck16', typesInferrer.dynamicType); |
- checkReturn('testIsCheck17', intType); |
- checkReturn('testIsCheck18', typesInferrer.dynamicType); |
- checkReturn('testIsCheck19', typesInferrer.dynamicType); |
- checkReturn('testIsCheck20', typesInferrer.dynamicType.nonNullable()); |
- checkReturn('returnAsString', |
- new TypeMask.subtype(compiler.stringClass.computeType(compiler))); |
- checkReturn('returnIntAsNum', typesInferrer.intType); |
- checkReturn('returnAsTypedef', typesInferrer.functionType.nullable()); |
- checkReturn('returnTopLevelGetter', typesInferrer.intType); |
- checkReturn('testDeadCode', typesInferrer.intType); |
- checkReturn('testLabeledIf', typesInferrer.intType.nullable()); |
- checkReturn('testSwitch1', typesInferrer.intType |
- .union(typesInferrer.doubleType, compiler).nullable().simplify(compiler)); |
- checkReturn('testSwitch2', typesInferrer.intType); |
- checkReturn('testSwitch3', interceptorType.nullable()); |
- checkReturn('testSwitch4', typesInferrer.intType); |
- checkReturn('testContinue1', interceptorType.nullable()); |
- checkReturn('testBreak1', interceptorType.nullable()); |
- checkReturn('testContinue2', interceptorType.nullable()); |
- checkReturn('testBreak2', typesInferrer.intType.nullable()); |
- checkReturn('testReturnElementOfConstList1', typesInferrer.intType); |
- checkReturn('testReturnElementOfConstList2', typesInferrer.intType); |
- checkReturn('testReturnItselfOrInt', typesInferrer.intType); |
- checkReturn('testReturnInvokeDynamicGetter', typesInferrer.dynamicType); |
- |
- checkReturnInClass(String className, String methodName, type) { |
- var cls = findElement(compiler, className); |
- var element = cls.lookupLocalMember(buildSourceString(methodName)); |
- Expect.equals(type, |
- typesInferrer.internal.returnTypeOf[element].simplify(compiler)); |
- } |
+ compiler.runCompiler(uri).then((_) { |
+ var typesInferrer = compiler.typesTask.typesInferrer; |
+ |
+ checkReturn(String name, type) { |
+ var element = findElement(compiler, name); |
+ Expect.equals( |
+ type, |
+ typesInferrer.internal.returnTypeOf[element].simplify(compiler), |
+ name); |
+ } |
+ var interceptorType = |
+ findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); |
+ |
+ checkReturn('returnNum1', typesInferrer.numType); |
+ checkReturn('returnNum2', typesInferrer.numType); |
+ checkReturn('returnInt1', typesInferrer.intType); |
+ checkReturn('returnInt2', typesInferrer.intType); |
+ checkReturn('returnDouble', typesInferrer.doubleType); |
+ checkReturn('returnGiveUp', interceptorType); |
+ checkReturn('returnInt5', typesInferrer.intType); |
+ checkReturn('returnInt6', typesInferrer.intType); |
+ checkReturn('returnIntOrNull', typesInferrer.intType.nullable()); |
+ checkReturn('returnInt3', typesInferrer.intType); |
+ checkReturn('returnDynamic', typesInferrer.dynamicType); |
+ checkReturn('returnInt4', typesInferrer.intType); |
+ checkReturn('returnInt7', typesInferrer.intType); |
+ checkReturn('returnInt8', typesInferrer.intType); |
+ checkReturn('returnDynamic1', typesInferrer.dynamicType); |
+ checkReturn('returnDynamic2', typesInferrer.dynamicType); |
+ TypeMask intType = new TypeMask.nonNullSubtype(compiler.intClass.rawType); |
+ checkReturn('testIsCheck1', intType); |
+ checkReturn('testIsCheck2', intType); |
+ checkReturn('testIsCheck3', intType.nullable()); |
+ checkReturn('testIsCheck4', intType); |
+ checkReturn('testIsCheck5', intType); |
+ checkReturn('testIsCheck6', typesInferrer.dynamicType); |
+ checkReturn('testIsCheck7', intType); |
+ checkReturn('testIsCheck8', typesInferrer.dynamicType); |
+ checkReturn('testIsCheck9', intType); |
+ checkReturn('testIsCheck10', typesInferrer.dynamicType); |
+ checkReturn('testIsCheck11', intType); |
+ checkReturn('testIsCheck12', typesInferrer.dynamicType); |
+ checkReturn('testIsCheck13', intType); |
+ checkReturn('testIsCheck14', typesInferrer.dynamicType); |
+ checkReturn('testIsCheck15', intType); |
+ checkReturn('testIsCheck16', typesInferrer.dynamicType); |
+ checkReturn('testIsCheck17', intType); |
+ checkReturn('testIsCheck18', typesInferrer.dynamicType); |
+ checkReturn('testIsCheck19', typesInferrer.dynamicType); |
+ checkReturn('testIsCheck20', typesInferrer.dynamicType.nonNullable()); |
+ checkReturn('returnAsString', |
+ new TypeMask.subtype(compiler.stringClass.computeType(compiler))); |
+ checkReturn('returnIntAsNum', typesInferrer.intType); |
+ checkReturn('returnAsTypedef', typesInferrer.functionType.nullable()); |
+ checkReturn('returnTopLevelGetter', typesInferrer.intType); |
+ checkReturn('testDeadCode', typesInferrer.intType); |
+ checkReturn('testLabeledIf', typesInferrer.intType.nullable()); |
+ checkReturn('testSwitch1', typesInferrer.intType |
+ .union(typesInferrer.doubleType, compiler) |
+ .nullable().simplify(compiler)); |
+ checkReturn('testSwitch2', typesInferrer.intType); |
+ checkReturn('testSwitch3', interceptorType.nullable()); |
+ checkReturn('testSwitch4', typesInferrer.intType); |
+ checkReturn('testContinue1', interceptorType.nullable()); |
+ checkReturn('testBreak1', interceptorType.nullable()); |
+ checkReturn('testContinue2', interceptorType.nullable()); |
+ checkReturn('testBreak2', typesInferrer.intType.nullable()); |
+ checkReturn('testReturnElementOfConstList1', typesInferrer.intType); |
+ checkReturn('testReturnElementOfConstList2', typesInferrer.intType); |
+ checkReturn('testReturnItselfOrInt', typesInferrer.intType); |
+ checkReturn('testReturnInvokeDynamicGetter', typesInferrer.dynamicType); |
+ |
+ checkReturnInClass(String className, String methodName, type) { |
+ var cls = findElement(compiler, className); |
+ var element = cls.lookupLocalMember(buildSourceString(methodName)); |
+ Expect.equals(type, |
+ typesInferrer.internal.returnTypeOf[element].simplify(compiler)); |
+ } |
- checkReturnInClass('A', 'returnInt1', typesInferrer.intType); |
- checkReturnInClass('A', 'returnInt2', typesInferrer.intType); |
- checkReturnInClass('A', 'returnInt3', typesInferrer.intType); |
- checkReturnInClass('A', 'returnInt4', typesInferrer.intType); |
- checkReturnInClass('A', 'returnInt5', typesInferrer.intType); |
- checkReturnInClass('A', 'returnInt6', typesInferrer.intType); |
- checkReturnInClass('A', '==', interceptorType); |
- |
- checkReturnInClass('B', 'returnInt1', typesInferrer.intType); |
- checkReturnInClass('B', 'returnInt2', typesInferrer.intType); |
- checkReturnInClass('B', 'returnInt3', typesInferrer.intType); |
- checkReturnInClass('B', 'returnInt4', typesInferrer.intType); |
- checkReturnInClass('B', 'returnInt5', typesInferrer.intType); |
- checkReturnInClass('B', 'returnInt6', typesInferrer.intType); |
- checkReturnInClass('B', 'returnInt7', typesInferrer.intType); |
- checkReturnInClass('B', 'returnInt8', typesInferrer.intType); |
- checkReturnInClass('B', 'returnInt9', typesInferrer.intType); |
- |
- checkFactoryConstructor(String className) { |
- var cls = findElement(compiler, className); |
- var element = cls.localLookup(buildSourceString(className)); |
- Expect.equals(new TypeMask.nonNullExact(cls.rawType), |
- typesInferrer.internal.returnTypeOf[element]); |
- } |
- checkFactoryConstructor('A'); |
+ checkReturnInClass('A', 'returnInt1', typesInferrer.intType); |
+ checkReturnInClass('A', 'returnInt2', typesInferrer.intType); |
+ checkReturnInClass('A', 'returnInt3', typesInferrer.intType); |
+ checkReturnInClass('A', 'returnInt4', typesInferrer.intType); |
+ checkReturnInClass('A', 'returnInt5', typesInferrer.intType); |
+ checkReturnInClass('A', 'returnInt6', typesInferrer.intType); |
+ checkReturnInClass('A', '==', interceptorType); |
+ |
+ checkReturnInClass('B', 'returnInt1', typesInferrer.intType); |
+ checkReturnInClass('B', 'returnInt2', typesInferrer.intType); |
+ checkReturnInClass('B', 'returnInt3', typesInferrer.intType); |
+ checkReturnInClass('B', 'returnInt4', typesInferrer.intType); |
+ checkReturnInClass('B', 'returnInt5', typesInferrer.intType); |
+ checkReturnInClass('B', 'returnInt6', typesInferrer.intType); |
+ checkReturnInClass('B', 'returnInt7', typesInferrer.intType); |
+ checkReturnInClass('B', 'returnInt8', typesInferrer.intType); |
+ checkReturnInClass('B', 'returnInt9', typesInferrer.intType); |
+ |
+ checkFactoryConstructor(String className) { |
+ var cls = findElement(compiler, className); |
+ var element = cls.localLookup(buildSourceString(className)); |
+ Expect.equals(new TypeMask.nonNullExact(cls.rawType), |
+ typesInferrer.internal.returnTypeOf[element]); |
+ } |
+ checkFactoryConstructor('A'); |
+ }); |
} |