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

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

Issue 2278213003: Rename the global inference task and reduce it's API surface by introducing the (Closed)
Patch Set: cl comments Created 4 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 import 'type_mask_test_helper.dart';
9 9
10 10
(...skipping 27 matching lines...) Expand all
38 Function.apply(foo5, []); 38 Function.apply(foo5, []);
39 Function.apply(foo6, []); 39 Function.apply(foo6, []);
40 } 40 }
41 """; 41 """;
42 42
43 43
44 void main() { 44 void main() {
45 Uri uri = new Uri(scheme: 'source'); 45 Uri uri = new Uri(scheme: 'source');
46 var compiler = compilerFor(TEST, uri); 46 var compiler = compilerFor(TEST, uri);
47 asyncTest(() => compiler.run(uri).then((_) { 47 asyncTest(() => compiler.run(uri).then((_) {
48 var typesInferrer = compiler.typesTask.typesInferrer; 48 var typesInferrer = compiler.globalInference.typesInferrer;
49 49
50 checkArgument(String functionName, type) { 50 checkArgument(String functionName, type) {
51 var functionElement = findElement(compiler, functionName); 51 var functionElement = findElement(compiler, functionName);
52 var signature = functionElement.functionSignature; 52 var signature = functionElement.functionSignature;
53 var element = signature.requiredParameterCount > 0 53 var element = signature.requiredParameterCount > 0
54 ? signature.requiredParameters.first 54 ? signature.requiredParameters.first
55 : signature.optionalParameters.first; 55 : signature.optionalParameters.first;
56 Expect.equals(type, 56 Expect.equals(type,
57 simplify(typesInferrer.getTypeOfElement(element), compiler), 57 simplify(typesInferrer.getTypeOfElement(element), compiler),
58 functionName); 58 functionName);
59 } 59 }
60 60
61 checkOptionalArgument(String functionName, type) { 61 checkOptionalArgument(String functionName, type) {
62 var functionElement = findElement(compiler, functionName); 62 var functionElement = findElement(compiler, functionName);
63 var signature = functionElement.functionSignature; 63 var signature = functionElement.functionSignature;
64 var element = signature.optionalParameters.first; 64 var element = signature.optionalParameters.first;
65 Expect.equals(type, 65 Expect.equals(type,
66 simplify(typesInferrer.getTypeOfElement(element), compiler), 66 simplify(typesInferrer.getTypeOfElement(element), compiler),
67 functionName); 67 functionName);
68 } 68 }
69 69
70 checkArgument('foo1', compiler.typesTask.functionType); /// 01: ok 70 checkArgument('foo1', compiler.commonMasks.functionType); /// 01: ok
71 checkArgument('foo2', compiler.typesTask.functionType); /// 02: ok 71 checkArgument('foo2', compiler.commonMasks.functionType); /// 02: ok
72 checkArgument('foo3', compiler.typesTask.functionType); /// 03: ok 72 checkArgument('foo3', compiler.commonMasks.functionType); /// 03: ok
73 checkArgument('foo4', compiler.typesTask.functionType); /// 04: ok 73 checkArgument('foo4', compiler.commonMasks.functionType); /// 04: ok
74 checkArgument('foo5', compiler.typesTask.dynamicType); /// 05: ok 74 checkArgument('foo5', compiler.commonMasks.dynamicType); /// 05: ok
75 checkArgument('foo6', compiler.typesTask.dynamicType); /// 06: ok 75 checkArgument('foo6', compiler.commonMasks.dynamicType); /// 06: ok
76 76
77 checkArgument('defaultFn1', compiler.typesTask.uint31Type); /// 07: ok 77 checkArgument('defaultFn1', compiler.commonMasks.uint31Type); /// 07: ok
78 checkArgument('defaultFn2', compiler.typesTask.uint31Type); /// 08: ok 78 checkArgument('defaultFn2', compiler.commonMasks.uint31Type); /// 08: ok
79 checkArgument('defaultFn3', compiler.typesTask.uint31Type); /// 09: ok 79 checkArgument('defaultFn3', compiler.commonMasks.uint31Type); /// 09: ok
80 checkArgument('defaultFn4', compiler.typesTask.uint31Type); /// 10: ok 80 checkArgument('defaultFn4', compiler.commonMasks.uint31Type); /// 10: ok
81 checkArgument('defaultFn5', compiler.typesTask.uint31Type); /// 11: ok 81 checkArgument('defaultFn5', compiler.commonMasks.uint31Type); /// 11: ok
82 checkArgument('defaultFn6', compiler.typesTask.uint31Type); /// 12: ok 82 checkArgument('defaultFn6', compiler.commonMasks.uint31Type); /// 12: ok
83 })); 83 }));
84 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698