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

Side by Side Diff: tests/compiler/dart2js/simple_inferrer_try_catch_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 import "package:async_helper/async_helper.dart";
6 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' 7 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
7 show TypeMask; 8 show TypeMask;
8 9
9 import 'compiler_helper.dart'; 10 import 'compiler_helper.dart';
10 11
11 const String TEST = """ 12 const String TEST = """
12 returnInt1() { 13 returnInt1() {
13 var a = 42; 14 var a = 42;
14 try { 15 try {
15 a = 54; 16 a = 54;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 returnInt6(); 160 returnInt6();
160 returnDyn6(); 161 returnDyn6();
161 returnInt7(); 162 returnInt7();
162 } 163 }
163 """; 164 """;
164 165
165 166
166 void main() { 167 void main() {
167 Uri uri = new Uri(scheme: 'source'); 168 Uri uri = new Uri(scheme: 'source');
168 var compiler = compilerFor(TEST, uri); 169 var compiler = compilerFor(TEST, uri);
169 compiler.runCompiler(uri); 170 asyncTest(() => compiler.runCompiler(uri).then((_) {
170 var typesTask = compiler.typesTask; 171 var typesTask = compiler.typesTask;
171 var typesInferrer = typesTask.typesInferrer; 172 var typesInferrer = typesTask.typesInferrer;
172 173
173 checkReturn(String name, type) { 174 checkReturn(String name, type) {
174 var element = findElement(compiler, name); 175 var element = findElement(compiler, name);
175 Expect.equals(type, 176 Expect.equals(type,
176 typesInferrer.getReturnTypeOfElement(element).simplify(compiler)); 177 typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
177 } 178 }
178 179
179 checkReturn('returnInt1', typesTask.intType); 180 checkReturn('returnInt1', typesTask.intType);
180 checkReturn('returnInt2', typesTask.intType); 181 checkReturn('returnInt2', typesTask.intType);
181 checkReturn('returnInt3', typesTask.intType); 182 checkReturn('returnInt3', typesTask.intType);
182 checkReturn('returnInt4', typesTask.intType); 183 checkReturn('returnInt4', typesTask.intType);
183 checkReturn('returnInt5', typesTask.intType); 184 checkReturn('returnInt5', typesTask.intType);
184 checkReturn('returnInt6', 185 checkReturn('returnInt6',
185 new TypeMask.nonNullSubtype(compiler.intClass.rawType)); 186 new TypeMask.nonNullSubtype(compiler.intClass.rawType));
186 checkReturn('returnInt7', typesTask.intType);
187 187
188 var subclassOfInterceptor = 188 var subclassOfInterceptor =
189 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); 189 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
190 190
191 checkReturn('returnDyn1', subclassOfInterceptor); 191 checkReturn('returnDyn1', subclassOfInterceptor);
192 checkReturn('returnDyn2', subclassOfInterceptor); 192 checkReturn('returnDyn2', subclassOfInterceptor);
193 checkReturn('returnDyn3', subclassOfInterceptor); 193 checkReturn('returnDyn3', subclassOfInterceptor);
194 checkReturn('returnDyn4', subclassOfInterceptor); 194 checkReturn('returnDyn4', subclassOfInterceptor);
195 checkReturn('returnDyn5', subclassOfInterceptor); 195 checkReturn('returnDyn5', subclassOfInterceptor);
196 checkReturn('returnDyn6', typesTask.dynamicType); 196 checkReturn('returnDyn6', typesTask.dynamicType);
197 }));
197 } 198 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/simple_inferrer_test.dart ('k') | tests/compiler/dart2js/simple_inferrer_unregister_call_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698