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

Unified Diff: tests/compiler/dart2js/simple_inferrer_test.dart

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove withCurrentElementAsync Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 fc6fe0aba3829f7253ec418062e8daf7b93dd5e8..0ea9a5e94fa77e1d7b67d499a3c72ad92c4edfa6 100644
--- a/tests/compiler/dart2js/simple_inferrer_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_test.dart
@@ -484,108 +484,110 @@ main() {
void main() {
Uri uri = new Uri(scheme: 'source');
var compiler = compilerFor(TEST, uri);
- compiler.runCompiler(uri);
- var typesTask = compiler.typesTask;
- var typesInferrer = typesTask.typesInferrer;
-
- checkReturn(String name, type) {
- var element = findElement(compiler, name);
- Expect.equals(
- type,
- typesInferrer.getReturnTypeOfElement(element).simplify(compiler),
- name);
- }
- var interceptorType =
- findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
-
- checkReturn('returnNum1', typesTask.numType);
- checkReturn('returnNum2', typesTask.numType);
- checkReturn('returnInt1', typesTask.intType);
- checkReturn('returnInt2', typesTask.intType);
- checkReturn('returnDouble', typesTask.doubleType);
- checkReturn('returnGiveUp', interceptorType);
- checkReturn('returnInt5', typesTask.intType);
- checkReturn('returnInt6', typesTask.intType);
- checkReturn('returnIntOrNull', typesTask.intType.nullable());
- checkReturn('returnInt3', typesTask.intType);
- checkReturn('returnDynamic', typesTask.dynamicType);
- checkReturn('returnInt4', typesTask.intType);
- checkReturn('returnInt7', typesTask.intType);
- checkReturn('returnInt8', typesTask.intType);
- checkReturn('returnDynamic1', typesTask.dynamicType);
- checkReturn('returnDynamic2', typesTask.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', typesTask.dynamicType);
- checkReturn('testIsCheck7', intType);
- checkReturn('testIsCheck8', typesTask.dynamicType);
- checkReturn('testIsCheck9', intType);
- checkReturn('testIsCheck10', typesTask.dynamicType);
- checkReturn('testIsCheck11', intType);
- checkReturn('testIsCheck12', typesTask.dynamicType);
- checkReturn('testIsCheck13', intType);
- checkReturn('testIsCheck14', typesTask.dynamicType);
- checkReturn('testIsCheck15', intType);
- checkReturn('testIsCheck16', typesTask.dynamicType);
- checkReturn('testIsCheck17', intType);
- checkReturn('testIsCheck18', typesTask.dynamicType);
- checkReturn('testIsCheck19', typesTask.dynamicType);
- checkReturn('testIsCheck20', typesTask.dynamicType.nonNullable());
- checkReturn('returnAsString',
- new TypeMask.subtype(compiler.stringClass.computeType(compiler)));
- checkReturn('returnIntAsNum', typesTask.intType);
- checkReturn('returnAsTypedef', typesTask.functionType.nullable());
- checkReturn('returnTopLevelGetter', typesTask.intType);
- checkReturn('testDeadCode', typesTask.intType);
- checkReturn('testLabeledIf', typesTask.intType.nullable());
- checkReturn('testSwitch1', typesTask.intType
- .union(typesTask.doubleType, compiler).nullable().simplify(compiler));
- checkReturn('testSwitch2', typesTask.intType);
- checkReturn('testSwitch3', interceptorType.nullable());
- checkReturn('testSwitch4', typesTask.intType);
- checkReturn('testContinue1', interceptorType.nullable());
- checkReturn('testBreak1', interceptorType.nullable());
- checkReturn('testContinue2', interceptorType.nullable());
- checkReturn('testBreak2', typesTask.intType.nullable());
- checkReturn('testReturnElementOfConstList1', typesTask.intType);
- checkReturn('testReturnElementOfConstList2', typesTask.intType);
- checkReturn('testReturnItselfOrInt', typesTask.intType);
- checkReturn('testReturnInvokeDynamicGetter', typesTask.dynamicType);
-
- checkReturnInClass(String className, String methodName, type) {
- var cls = findElement(compiler, className);
- var element = cls.lookupLocalMember(buildSourceString(methodName));
- Expect.equals(type,
- typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
- }
+ compiler.runCompiler(uri).then((_) {
+ var typesTask = compiler.typesTask;
+ var typesInferrer = typesTask.typesInferrer;
+
+ checkReturn(String name, type) {
+ var element = findElement(compiler, name);
+ Expect.equals(
+ type,
+ typesInferrer.getReturnTypeOfElement(element).simplify(compiler),
+ name);
+ }
+ var interceptorType =
+ findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
+
+ checkReturn('returnNum1', typesTask.numType);
+ checkReturn('returnNum2', typesTask.numType);
+ checkReturn('returnInt1', typesTask.intType);
+ checkReturn('returnInt2', typesTask.intType);
+ checkReturn('returnDouble', typesTask.doubleType);
+ checkReturn('returnGiveUp', interceptorType);
+ checkReturn('returnInt5', typesTask.intType);
+ checkReturn('returnInt6', typesTask.intType);
+ checkReturn('returnIntOrNull', typesTask.intType.nullable());
+ checkReturn('returnInt3', typesTask.intType);
+ checkReturn('returnDynamic', typesTask.dynamicType);
+ checkReturn('returnInt4', typesTask.intType);
+ checkReturn('returnInt7', typesTask.intType);
+ checkReturn('returnInt8', typesTask.intType);
+ checkReturn('returnDynamic1', typesTask.dynamicType);
+ checkReturn('returnDynamic2', typesTask.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', typesTask.dynamicType);
+ checkReturn('testIsCheck7', intType);
+ checkReturn('testIsCheck8', typesTask.dynamicType);
+ checkReturn('testIsCheck9', intType);
+ checkReturn('testIsCheck10', typesTask.dynamicType);
+ checkReturn('testIsCheck11', intType);
+ checkReturn('testIsCheck12', typesTask.dynamicType);
+ checkReturn('testIsCheck13', intType);
+ checkReturn('testIsCheck14', typesTask.dynamicType);
+ checkReturn('testIsCheck15', intType);
+ checkReturn('testIsCheck16', typesTask.dynamicType);
+ checkReturn('testIsCheck17', intType);
+ checkReturn('testIsCheck18', typesTask.dynamicType);
+ checkReturn('testIsCheck19', typesTask.dynamicType);
+ checkReturn('testIsCheck20', typesTask.dynamicType.nonNullable());
+ checkReturn('returnAsString',
+ new TypeMask.subtype(compiler.stringClass.computeType(compiler)));
+ checkReturn('returnIntAsNum', typesTask.intType);
+ checkReturn('returnAsTypedef', typesTask.functionType.nullable());
+ checkReturn('returnTopLevelGetter', typesTask.intType);
+ checkReturn('testDeadCode', typesTask.intType);
+ checkReturn('testLabeledIf', typesTask.intType.nullable());
+ checkReturn('testSwitch1', typesTask.intType
+ .union(typesTask.doubleType, compiler)
+ .nullable().simplify(compiler));
+ checkReturn('testSwitch2', typesTask.intType);
+ checkReturn('testSwitch3', interceptorType.nullable());
+ checkReturn('testSwitch4', typesTask.intType);
+ checkReturn('testContinue1', interceptorType.nullable());
+ checkReturn('testBreak1', interceptorType.nullable());
+ checkReturn('testContinue2', interceptorType.nullable());
+ checkReturn('testBreak2', typesTask.intType.nullable());
+ checkReturn('testReturnElementOfConstList1', typesTask.intType);
+ checkReturn('testReturnElementOfConstList2', typesTask.intType);
+ checkReturn('testReturnItselfOrInt', typesTask.intType);
+ checkReturn('testReturnInvokeDynamicGetter', typesTask.dynamicType);
+
+ checkReturnInClass(String className, String methodName, type) {
+ var cls = findElement(compiler, className);
+ var element = cls.lookupLocalMember(buildSourceString(methodName));
+ Expect.equals(type,
+ typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
+ }
- checkReturnInClass('A', 'returnInt1', typesTask.intType);
- checkReturnInClass('A', 'returnInt2', typesTask.intType);
- checkReturnInClass('A', 'returnInt3', typesTask.intType);
- checkReturnInClass('A', 'returnInt4', typesTask.intType);
- checkReturnInClass('A', 'returnInt5', typesTask.intType);
- checkReturnInClass('A', 'returnInt6', typesTask.intType);
- checkReturnInClass('A', '==', interceptorType);
-
- checkReturnInClass('B', 'returnInt1', typesTask.intType);
- checkReturnInClass('B', 'returnInt2', typesTask.intType);
- checkReturnInClass('B', 'returnInt3', typesTask.intType);
- checkReturnInClass('B', 'returnInt4', typesTask.intType);
- checkReturnInClass('B', 'returnInt5', typesTask.intType);
- checkReturnInClass('B', 'returnInt6', typesTask.intType);
- checkReturnInClass('B', 'returnInt7', typesTask.intType);
- checkReturnInClass('B', 'returnInt8', typesTask.intType);
- checkReturnInClass('B', 'returnInt9', typesTask.intType);
-
- checkFactoryConstructor(String className, String factoryName) {
- var cls = findElement(compiler, className);
- var element = cls.localLookup(buildSourceString(factoryName));
- Expect.equals(new TypeMask.nonNullExact(cls.rawType),
- typesInferrer.getReturnTypeOfElement(element));
- }
- checkFactoryConstructor('A', '');
+ checkReturnInClass('A', 'returnInt1', typesTask.intType);
+ checkReturnInClass('A', 'returnInt2', typesTask.intType);
+ checkReturnInClass('A', 'returnInt3', typesTask.intType);
+ checkReturnInClass('A', 'returnInt4', typesTask.intType);
+ checkReturnInClass('A', 'returnInt5', typesTask.intType);
+ checkReturnInClass('A', 'returnInt6', typesTask.intType);
+ checkReturnInClass('A', '==', interceptorType);
+
+ checkReturnInClass('B', 'returnInt1', typesTask.intType);
+ checkReturnInClass('B', 'returnInt2', typesTask.intType);
+ checkReturnInClass('B', 'returnInt3', typesTask.intType);
+ checkReturnInClass('B', 'returnInt4', typesTask.intType);
+ checkReturnInClass('B', 'returnInt5', typesTask.intType);
+ checkReturnInClass('B', 'returnInt6', typesTask.intType);
+ checkReturnInClass('B', 'returnInt7', typesTask.intType);
+ checkReturnInClass('B', 'returnInt8', typesTask.intType);
+ checkReturnInClass('B', 'returnInt9', typesTask.intType);
+
+ checkFactoryConstructor(String className, String factoryName) {
+ var cls = findElement(compiler, className);
+ var element = cls.localLookup(buildSourceString(factoryName));
+ Expect.equals(new TypeMask.nonNullExact(cls.rawType),
+ typesInferrer.getReturnTypeOfElement(element));
+ }
+ checkFactoryConstructor('A', '');
+ });
}

Powered by Google App Engine
This is Rietveld 408576698