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

Side by Side Diff: tests/compiler/dart2js/simple_inferrer_and_or_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 'compiler_helper.dart'; 7 import 'compiler_helper.dart';
8 import 'type_mask_test_helper.dart';
8 9
9 const String TEST = """ 10 const String TEST = """
10 class X {} 11 class X {}
11 returnDyn1() { 12 returnDyn1() {
12 var a; 13 var a;
13 ((a = 52) == true) || ((a = 'foo') == true); 14 ((a = 52) == true) || ((a = 'foo') == true);
14 return a; 15 return a;
15 } 16 }
16 17
17 returnDyn2() { 18 returnDyn2() {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 58
58 void main() { 59 void main() {
59 Uri uri = new Uri(scheme: 'source'); 60 Uri uri = new Uri(scheme: 'source');
60 var compiler = compilerFor(TEST, uri); 61 var compiler = compilerFor(TEST, uri);
61 asyncTest(() => compiler.runCompiler(uri).then((_) { 62 asyncTest(() => compiler.runCompiler(uri).then((_) {
62 var typesInferrer = compiler.typesTask.typesInferrer; 63 var typesInferrer = compiler.typesTask.typesInferrer;
63 64
64 checkReturn(String name, type) { 65 checkReturn(String name, type) {
65 var element = findElement(compiler, name); 66 var element = findElement(compiler, name);
66 Expect.equals(type, 67 Expect.equals(type,
67 typesInferrer.getReturnTypeOfElement(element).simplify(compiler)); 68 simplify(typesInferrer.getReturnTypeOfElement(element), compiler));
68 } 69 }
69 70
70 var subclassOfInterceptor = 71 var subclassOfInterceptor =
71 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); 72 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
72 73
73 checkReturn('returnDyn1', subclassOfInterceptor); 74 checkReturn('returnDyn1', subclassOfInterceptor);
74 checkReturn('returnDyn2', subclassOfInterceptor); 75 checkReturn('returnDyn2', subclassOfInterceptor);
75 checkReturn('returnDyn3', subclassOfInterceptor); 76 checkReturn('returnDyn3', subclassOfInterceptor);
76 checkReturn('returnDyn4', compiler.typesTask.dynamicType.nonNullable()); 77 checkReturn('returnDyn4', compiler.typesTask.dynamicType.nonNullable());
77 checkReturn('returnDyn5', compiler.typesTask.dynamicType.nonNullable()); 78 checkReturn('returnDyn5', compiler.typesTask.dynamicType.nonNullable());
78 checkReturn('returnDyn6', compiler.typesTask.dynamicType.nonNullable()); 79 checkReturn('returnDyn6', compiler.typesTask.dynamicType.nonNullable());
79 })); 80 }));
80 } 81 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/mirror_final_field_inferrer_test.dart ('k') | tests/compiler/dart2js/simple_inferrer_closure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698