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

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

Issue 2577423002: Further reduce use of Compiler.closedWorld. (Closed)
Patch Set: Created 4 years 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 25 matching lines...) Expand all
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.typesInferrerInternal; 45 var typesInferrer = compiler.globalInference.typesInferrerInternal;
46 var closedWorld = typesInferrer.closedWorld;
46 47
47 checkArgument(String functionName, type) { 48 checkArgument(String functionName, type) {
48 var functionElement = findElement(compiler, functionName); 49 var functionElement = findElement(compiler, functionName);
49 var signature = functionElement.functionSignature; 50 var signature = functionElement.functionSignature;
50 var element = signature.requiredParameterCount > 0 51 var element = signature.requiredParameterCount > 0
51 ? signature.requiredParameters.first 52 ? signature.requiredParameters.first
52 : signature.optionalParameters.first; 53 : signature.optionalParameters.first;
53 Expect.equals( 54 Expect.equals(
54 type, 55 type,
55 simplify(typesInferrer.getTypeOfElement(element), compiler), 56 simplify(typesInferrer.getTypeOfElement(element), closedWorld),
56 functionName); 57 functionName);
57 } 58 }
58 59
59 checkOptionalArgument(String functionName, type) { 60 checkOptionalArgument(String functionName, type) {
60 var functionElement = findElement(compiler, functionName); 61 var functionElement = findElement(compiler, functionName);
61 var signature = functionElement.functionSignature; 62 var signature = functionElement.functionSignature;
62 var element = signature.optionalParameters.first; 63 var element = signature.optionalParameters.first;
63 Expect.equals( 64 Expect.equals(
64 type, 65 type,
65 simplify(typesInferrer.getTypeOfElement(element), compiler), 66 simplify(typesInferrer.getTypeOfElement(element), closedWorld),
66 functionName); 67 functionName);
67 } 68 }
68 69
69 checkArgument('foo1', compiler.closedWorld.commonMasks.functionType); 70 checkArgument('foo1', closedWorld.commonMasks.functionType);
70 71
71 /// 01: ok 72 /// 01: ok
72 checkArgument('foo2', compiler.closedWorld.commonMasks.functionType); 73 checkArgument('foo2', closedWorld.commonMasks.functionType);
73 74
74 /// 02: ok 75 /// 02: ok
75 checkArgument('foo3', compiler.closedWorld.commonMasks.functionType); 76 checkArgument('foo3', closedWorld.commonMasks.functionType);
76 77
77 /// 03: ok 78 /// 03: ok
78 checkArgument('foo4', compiler.closedWorld.commonMasks.functionType); 79 checkArgument('foo4', closedWorld.commonMasks.functionType);
79 80
80 /// 04: ok 81 /// 04: ok
81 checkArgument('foo5', compiler.closedWorld.commonMasks.dynamicType); 82 checkArgument('foo5', closedWorld.commonMasks.dynamicType);
82 83
83 /// 05: ok 84 /// 05: ok
84 checkArgument('foo6', compiler.closedWorld.commonMasks.dynamicType); 85 checkArgument('foo6', closedWorld.commonMasks.dynamicType);
85 86
86 /// 06: ok 87 /// 06: ok
87 88
88 checkArgument( 89 checkArgument('defaultFn1', closedWorld.commonMasks.uint31Type);
89 'defaultFn1', compiler.closedWorld.commonMasks.uint31Type);
90 90
91 /// 07: ok 91 /// 07: ok
92 checkArgument( 92 checkArgument('defaultFn2', closedWorld.commonMasks.uint31Type);
93 'defaultFn2', compiler.closedWorld.commonMasks.uint31Type);
94 93
95 /// 08: ok 94 /// 08: ok
96 checkArgument( 95 checkArgument('defaultFn3', closedWorld.commonMasks.uint31Type);
97 'defaultFn3', compiler.closedWorld.commonMasks.uint31Type);
98 96
99 /// 09: ok 97 /// 09: ok
100 checkArgument( 98 checkArgument('defaultFn4', closedWorld.commonMasks.uint31Type);
101 'defaultFn4', compiler.closedWorld.commonMasks.uint31Type);
102 99
103 /// 10: ok 100 /// 10: ok
104 checkArgument( 101 checkArgument('defaultFn5', closedWorld.commonMasks.uint31Type);
105 'defaultFn5', compiler.closedWorld.commonMasks.uint31Type);
106 102
107 /// 11: ok 103 /// 11: ok
108 checkArgument( 104 checkArgument('defaultFn6', closedWorld.commonMasks.uint31Type);
109 'defaultFn6', compiler.closedWorld.commonMasks.uint31Type);
110 105
111 /// 12: ok 106 /// 12: ok
112 })); 107 }));
113 } 108 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698