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

Side by Side Diff: tests/compiler/dart2js/simple_inferrer_and_or_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) 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 import 'type_mask_test_helper.dart';
9 9
10 const String TEST = """ 10 const String TEST = """
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 test9(); 90 test9();
91 test10(); 91 test10();
92 } 92 }
93 """; 93 """;
94 94
95 void main() { 95 void main() {
96 Uri uri = new Uri(scheme: 'source'); 96 Uri uri = new Uri(scheme: 'source');
97 var compiler = compilerFor(TEST, uri); 97 var compiler = compilerFor(TEST, uri);
98 asyncTest(() => compiler.run(uri).then((_) { 98 asyncTest(() => compiler.run(uri).then((_) {
99 var typesInferrer = compiler.globalInference.typesInferrerInternal; 99 var typesInferrer = compiler.globalInference.typesInferrerInternal;
100 var closedWorld = typesInferrer.closedWorld;
100 101
101 checkReturn(String name, type) { 102 checkReturn(String name, type) {
102 var element = findElement(compiler, name); 103 var element = findElement(compiler, name);
103 Expect.equals( 104 Expect.equals(
104 type, 105 type,
105 simplify( 106 simplify(
106 typesInferrer.getReturnTypeOfElement(element), compiler)); 107 typesInferrer.getReturnTypeOfElement(element), closedWorld));
107 } 108 }
108 109
109 var subclassOfInterceptor = 110 var subclassOfInterceptor = closedWorld.commonMasks.interceptorType;
110 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
111 111
112 checkReturn('returnDyn1', subclassOfInterceptor); 112 checkReturn('returnDyn1', subclassOfInterceptor);
113 checkReturn('returnDyn2', subclassOfInterceptor); 113 checkReturn('returnDyn2', subclassOfInterceptor);
114 checkReturn('returnDyn3', subclassOfInterceptor); 114 checkReturn('returnDyn3', subclassOfInterceptor);
115 checkReturn('returnDyn4', 115 checkReturn(
116 compiler.closedWorld.commonMasks.dynamicType.nonNullable()); 116 'returnDyn4', closedWorld.commonMasks.dynamicType.nonNullable());
117 checkReturn('returnDyn5', 117 checkReturn(
118 compiler.closedWorld.commonMasks.dynamicType.nonNullable()); 118 'returnDyn5', closedWorld.commonMasks.dynamicType.nonNullable());
119 checkReturn('returnDyn6', 119 checkReturn(
120 compiler.closedWorld.commonMasks.dynamicType.nonNullable()); 120 'returnDyn6', closedWorld.commonMasks.dynamicType.nonNullable());
121 checkReturn('returnDyn7', subclassOfInterceptor); 121 checkReturn('returnDyn7', subclassOfInterceptor);
122 checkReturn('returnDyn7b', subclassOfInterceptor); 122 checkReturn('returnDyn7b', subclassOfInterceptor);
123 checkReturn('returnDyn8', subclassOfInterceptor); 123 checkReturn('returnDyn8', subclassOfInterceptor);
124 checkReturn('returnDyn9', subclassOfInterceptor); 124 checkReturn('returnDyn9', subclassOfInterceptor);
125 checkReturn( 125 checkReturn('returnString', closedWorld.commonMasks.stringType);
126 'returnString', compiler.closedWorld.commonMasks.stringType);
127 })); 126 }));
128 } 127 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/needs_no_such_method_test.dart ('k') | tests/compiler/dart2js/simple_inferrer_callers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698