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

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

Issue 2488353004: Remove Compiler access from ResolutionEnqueuer (Closed)
Patch Set: Updated cf. comments. Created 4 years, 1 month 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 const String TEST = """ 10 const String TEST = """
(...skipping 24 matching lines...) Expand all
35 // Calls via Function.apply. 35 // Calls via Function.apply.
36 Function.apply(foo5, []); 36 Function.apply(foo5, []);
37 Function.apply(foo6, []); 37 Function.apply(foo6, []);
38 } 38 }
39 """; 39 """;
40 40
41 void main() { 41 void main() {
42 Uri uri = new Uri(scheme: 'source'); 42 Uri uri = new Uri(scheme: 'source');
43 var compiler = compilerFor(TEST, uri); 43 var compiler = compilerFor(TEST, uri);
44 asyncTest(() => compiler.run(uri).then((_) { 44 asyncTest(() => compiler.run(uri).then((_) {
45 var typesInferrer = compiler.globalInference.typesInferrer; 45 var typesInferrer = compiler.globalInference.typesInferrerInternal;
46 46
47 checkArgument(String functionName, type) { 47 checkArgument(String functionName, type) {
48 var functionElement = findElement(compiler, functionName); 48 var functionElement = findElement(compiler, functionName);
49 var signature = functionElement.functionSignature; 49 var signature = functionElement.functionSignature;
50 var element = signature.requiredParameterCount > 0 50 var element = signature.requiredParameterCount > 0
51 ? signature.requiredParameters.first 51 ? signature.requiredParameters.first
52 : signature.optionalParameters.first; 52 : signature.optionalParameters.first;
53 Expect.equals( 53 Expect.equals(
54 type, 54 type,
55 simplify(typesInferrer.getTypeOfElement(element), compiler), 55 simplify(typesInferrer.getTypeOfElement(element), compiler),
56 functionName); 56 functionName);
57 } 57 }
58 58
59 checkOptionalArgument(String functionName, type) { 59 checkOptionalArgument(String functionName, type) {
60 var functionElement = findElement(compiler, functionName); 60 var functionElement = findElement(compiler, functionName);
61 var signature = functionElement.functionSignature; 61 var signature = functionElement.functionSignature;
62 var element = signature.optionalParameters.first; 62 var element = signature.optionalParameters.first;
63 Expect.equals( 63 Expect.equals(
64 type, 64 type,
65 simplify(typesInferrer.getTypeOfElement(element), compiler), 65 simplify(typesInferrer.getTypeOfElement(element), compiler),
66 functionName); 66 functionName);
67 } 67 }
68 68
69 checkArgument('foo1', compiler.commonMasks.functionType); 69 checkArgument('foo1', compiler.closedWorld.commonMasks.functionType);
70 70
71 /// 01: ok 71 /// 01: ok
72 checkArgument('foo2', compiler.commonMasks.functionType); 72 checkArgument('foo2', compiler.closedWorld.commonMasks.functionType);
73 73
74 /// 02: ok 74 /// 02: ok
75 checkArgument('foo3', compiler.commonMasks.functionType); 75 checkArgument('foo3', compiler.closedWorld.commonMasks.functionType);
76 76
77 /// 03: ok 77 /// 03: ok
78 checkArgument('foo4', compiler.commonMasks.functionType); 78 checkArgument('foo4', compiler.closedWorld.commonMasks.functionType);
79 79
80 /// 04: ok 80 /// 04: ok
81 checkArgument('foo5', compiler.commonMasks.dynamicType); 81 checkArgument('foo5', compiler.closedWorld.commonMasks.dynamicType);
82 82
83 /// 05: ok 83 /// 05: ok
84 checkArgument('foo6', compiler.commonMasks.dynamicType); 84 checkArgument('foo6', compiler.closedWorld.commonMasks.dynamicType);
85 85
86 /// 06: ok 86 /// 06: ok
87 87
88 checkArgument('defaultFn1', compiler.commonMasks.uint31Type); 88 checkArgument(
89 'defaultFn1', compiler.closedWorld.commonMasks.uint31Type);
89 90
90 /// 07: ok 91 /// 07: ok
91 checkArgument('defaultFn2', compiler.commonMasks.uint31Type); 92 checkArgument(
93 'defaultFn2', compiler.closedWorld.commonMasks.uint31Type);
92 94
93 /// 08: ok 95 /// 08: ok
94 checkArgument('defaultFn3', compiler.commonMasks.uint31Type); 96 checkArgument(
97 'defaultFn3', compiler.closedWorld.commonMasks.uint31Type);
95 98
96 /// 09: ok 99 /// 09: ok
97 checkArgument('defaultFn4', compiler.commonMasks.uint31Type); 100 checkArgument(
101 'defaultFn4', compiler.closedWorld.commonMasks.uint31Type);
98 102
99 /// 10: ok 103 /// 10: ok
100 checkArgument('defaultFn5', compiler.commonMasks.uint31Type); 104 checkArgument(
105 'defaultFn5', compiler.closedWorld.commonMasks.uint31Type);
101 106
102 /// 11: ok 107 /// 11: ok
103 checkArgument('defaultFn6', compiler.commonMasks.uint31Type); 108 checkArgument(
109 'defaultFn6', compiler.closedWorld.commonMasks.uint31Type);
104 110
105 /// 12: ok 111 /// 12: ok
106 })); 112 }));
107 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698