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

Side by Side Diff: tests/compiler/dart2js/simple_inferrer_no_such_method_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: Updated cf. comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 6
7 import "package:async_helper/async_helper.dart";
7 import 'compiler_helper.dart'; 8 import 'compiler_helper.dart';
8 import 'parser_helper.dart'; 9 import 'parser_helper.dart';
9 10
10 const String TEST1 = """ 11 const String TEST1 = """
11 class A { 12 class A {
12 noSuchMethod(im) => 42; 13 noSuchMethod(im) => 42;
13 } 14 }
14 15
15 class B extends A { 16 class B extends A {
16 foo(); 17 foo();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 test8(); 89 test8();
89 test9(); 90 test9();
90 test10(); 91 test10();
91 test11(); 92 test11();
92 } 93 }
93 """; 94 """;
94 95
95 main() { 96 main() {
96 Uri uri = new Uri(scheme: 'source'); 97 Uri uri = new Uri(scheme: 'source');
97 98
98 var compiler = compilerFor(TEST1, uri); 99 checkReturn(MockCompiler compiler, String name, type) {
99 compiler.runCompiler(uri); 100 var typesInferrer = compiler.typesTask.typesInferrer;
100 var typesInferrer = compiler.typesTask.typesInferrer;
101
102 checkReturn(String name, type) {
103 var element = findElement(compiler, name); 101 var element = findElement(compiler, name);
104 Expect.equals( 102 Expect.equals(
105 type, 103 type,
106 typesInferrer.getReturnTypeOfElement(element).simplify(compiler), 104 typesInferrer.getReturnTypeOfElement(element).simplify(compiler),
107 name); 105 name);
108 } 106 }
109 107
110 checkReturn('test1', compiler.typesTask.intType); 108 var compiler1 = compilerFor(TEST1, uri);
111 checkReturn('test2', compiler.typesTask.dynamicType.nonNullable()); 109 asyncTest(() => compiler1.runCompiler(uri).then((_) {
112 checkReturn('test3', compiler.typesTask.intType); 110 checkReturn(compiler1, 'test1', compiler1.typesTask.intType);
113 checkReturn('test4', compiler.typesTask.mapType); 111 checkReturn(compiler1, 'test2',
114 checkReturn('test5', compiler.typesTask.dynamicType.nonNullable()); 112 compiler1.typesTask.dynamicType.nonNullable());
115 checkReturn('test6', compiler.typesTask.dynamicType.nonNullable()); 113 checkReturn(compiler1, 'test3', compiler1.typesTask.intType);
114 checkReturn(compiler1, 'test4', compiler1.typesTask.mapType);
115 checkReturn(compiler1, 'test5',
116 compiler1.typesTask.dynamicType.nonNullable());
117 checkReturn(compiler1, 'test6',
118 compiler1.typesTask.dynamicType.nonNullable());
119 }));
116 120
117 compiler = compilerFor(TEST2, uri); 121 var compiler2 = compilerFor(TEST2, uri);
118 compiler.runCompiler(uri); 122 asyncTest(() => compiler2.runCompiler(uri).then((_) {
119 typesInferrer = compiler.typesTask.typesInferrer; 123 checkReturn(compiler2, 'test1',
124 compiler2.typesTask.dynamicType.nonNullable());
125 checkReturn(compiler2, 'test2', compiler2.typesTask.mapType);
126 checkReturn(compiler2, 'test3', compiler2.typesTask.mapType);
127 checkReturn(compiler2, 'test4', compiler2.typesTask.mapType);
128 checkReturn(compiler2, 'test5', compiler2.typesTask.mapType);
120 129
121 checkReturn('test1', compiler.typesTask.dynamicType.nonNullable()); 130 checkReturn(compiler2, 'test6', compiler2.typesTask.numType);
122 checkReturn('test2', compiler.typesTask.mapType); 131 checkReturn(compiler2, 'test7', compiler2.typesTask.intType);
123 checkReturn('test3', compiler.typesTask.mapType); 132 checkReturn(compiler2, 'test8', compiler2.typesTask.intType);
124 checkReturn('test4', compiler.typesTask.mapType); 133 checkReturn(compiler2, 'test9', compiler2.typesTask.intType);
125 checkReturn('test5', compiler.typesTask.mapType); 134 checkReturn(compiler2, 'test10', compiler2.typesTask.numType);
126 135 checkReturn(compiler2, 'test11', compiler2.typesTask.doubleType);
127 checkReturn('test6', compiler.typesTask.numType); 136 }));
128 checkReturn('test7', compiler.typesTask.intType);
129 checkReturn('test8', compiler.typesTask.intType);
130 checkReturn('test9', compiler.typesTask.intType);
131 checkReturn('test10', compiler.typesTask.numType);
132 checkReturn('test11', compiler.typesTask.doubleType);
133 } 137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698