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

Side by Side Diff: tests/compiler/dart2js/closure_tracer_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 7
8 import 'compiler_helper.dart'; 8 import 'compiler_helper.dart';
9 import 'parser_helper.dart'; 9 import 'parser_helper.dart';
10 import 'type_mask_test_helper.dart';
10 11
11 const String TEST = ''' 12 const String TEST = '''
12 testFunctionStatement() { 13 testFunctionStatement() {
13 var res; 14 var res;
14 closure(a) => res = a; 15 closure(a) => res = a;
15 closure(42); 16 closure(42);
16 return res; 17 return res;
17 } 18 }
18 19
19 testFunctionExpression() { 20 testFunctionExpression() {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 void main() { 110 void main() {
110 Uri uri = new Uri(scheme: 'source'); 111 Uri uri = new Uri(scheme: 'source');
111 var compiler = compilerFor(TEST, uri); 112 var compiler = compilerFor(TEST, uri);
112 asyncTest(() => compiler.runCompiler(uri).then((_) { 113 asyncTest(() => compiler.runCompiler(uri).then((_) {
113 var typesTask = compiler.typesTask; 114 var typesTask = compiler.typesTask;
114 var typesInferrer = typesTask.typesInferrer; 115 var typesInferrer = typesTask.typesInferrer;
115 116
116 checkType(String name, type) { 117 checkType(String name, type) {
117 var element = findElement(compiler, name); 118 var element = findElement(compiler, name);
118 var mask = typesInferrer.getReturnTypeOfElement(element); 119 var mask = typesInferrer.getReturnTypeOfElement(element);
119 Expect.equals(type.nullable(), mask.simplify(compiler), name); 120 Expect.equals(type.nullable(), simplify(mask, compiler), name);
120 } 121 }
121 122
122 checkType('testFunctionStatement', typesTask.uint31Type); 123 checkType('testFunctionStatement', typesTask.uint31Type);
123 checkType('testFunctionExpression', typesTask.uint31Type); 124 checkType('testFunctionExpression', typesTask.uint31Type);
124 checkType('testStoredInInstance', typesTask.uint31Type); 125 checkType('testStoredInInstance', typesTask.uint31Type);
125 checkType('testStoredInStatic', typesTask.uint31Type); 126 checkType('testStoredInStatic', typesTask.uint31Type);
126 checkType('testPassedInParameter', typesTask.uint31Type); 127 checkType('testPassedInParameter', typesTask.uint31Type);
127 checkType('testStaticClosure1', typesTask.uint31Type); 128 checkType('testStaticClosure1', typesTask.uint31Type);
128 checkType('testStaticClosure2', typesTask.numType); 129 checkType('testStaticClosure2', typesTask.numType);
129 checkType('testStaticClosure3', typesTask.uint31Type); 130 checkType('testStaticClosure3', typesTask.uint31Type);
130 checkType('testStaticClosure4', typesTask.numType); 131 checkType('testStaticClosure4', typesTask.numType);
131 })); 132 }));
132 } 133 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/call_site_simple_type_inferer_test.dart ('k') | tests/compiler/dart2js/cpa_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698