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

Side by Side Diff: tests/compiler/dart2js/simple_inferrer_try_catch_test.dart

Issue 165143004: Move TypeMask.simplify to a test helper. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 6 years, 10 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 "package:async_helper/async_helper.dart";
7 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' 7 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
8 show TypeMask; 8 show TypeMask;
9 9
10 import 'compiler_helper.dart'; 10 import 'compiler_helper.dart';
11 import 'type_mask_test_helper.dart';
11 12
12 const String TEST = """ 13 const String TEST = """
13 returnInt1() { 14 returnInt1() {
14 var a = 42; 15 var a = 42;
15 try { 16 try {
16 a = 54; 17 a = 54;
17 } catch (e){ 18 } catch (e){
18 } 19 }
19 return a; 20 return a;
20 } 21 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 void main() { 168 void main() {
168 Uri uri = new Uri(scheme: 'source'); 169 Uri uri = new Uri(scheme: 'source');
169 var compiler = compilerFor(TEST, uri); 170 var compiler = compilerFor(TEST, uri);
170 asyncTest(() => compiler.runCompiler(uri).then((_) { 171 asyncTest(() => compiler.runCompiler(uri).then((_) {
171 var typesTask = compiler.typesTask; 172 var typesTask = compiler.typesTask;
172 var typesInferrer = typesTask.typesInferrer; 173 var typesInferrer = typesTask.typesInferrer;
173 174
174 checkReturn(String name, type) { 175 checkReturn(String name, type) {
175 var element = findElement(compiler, name); 176 var element = findElement(compiler, name);
176 Expect.equals(type, 177 Expect.equals(type,
177 typesInferrer.getReturnTypeOfElement(element).simplify(compiler)); 178 simplify(typesInferrer.getReturnTypeOfElement(element), compiler));
178 } 179 }
179 180
180 checkReturn('returnInt1', typesTask.uint31Type); 181 checkReturn('returnInt1', typesTask.uint31Type);
181 checkReturn('returnInt2', typesTask.uint31Type); 182 checkReturn('returnInt2', typesTask.uint31Type);
182 checkReturn('returnInt3', typesTask.uint31Type); 183 checkReturn('returnInt3', typesTask.uint31Type);
183 checkReturn('returnInt4', typesTask.uint31Type); 184 checkReturn('returnInt4', typesTask.uint31Type);
184 checkReturn('returnInt5', typesTask.uint31Type); 185 checkReturn('returnInt5', typesTask.uint31Type);
185 checkReturn('returnInt6', 186 checkReturn('returnInt6',
186 new TypeMask.nonNullSubtype(compiler.intClass)); 187 new TypeMask.nonNullSubtype(compiler.intClass));
187 188
188 var subclassOfInterceptor = 189 var subclassOfInterceptor =
189 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); 190 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
190 191
191 checkReturn('returnDyn1', subclassOfInterceptor); 192 checkReturn('returnDyn1', subclassOfInterceptor);
192 checkReturn('returnDyn2', subclassOfInterceptor); 193 checkReturn('returnDyn2', subclassOfInterceptor);
193 checkReturn('returnDyn3', subclassOfInterceptor); 194 checkReturn('returnDyn3', subclassOfInterceptor);
194 checkReturn('returnDyn4', subclassOfInterceptor); 195 checkReturn('returnDyn4', subclassOfInterceptor);
195 checkReturn('returnDyn5', subclassOfInterceptor); 196 checkReturn('returnDyn5', subclassOfInterceptor);
196 checkReturn('returnDyn6', typesTask.dynamicType); 197 checkReturn('returnDyn6', typesTask.dynamicType);
197 })); 198 }));
198 } 199 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/simple_inferrer_test.dart ('k') | tests/compiler/dart2js/type_combination_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698