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

Side by Side Diff: tests/compiler/dart2js/assert_message_throw_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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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:async_helper/async_helper.dart'; 5 import 'package:async_helper/async_helper.dart';
6 import 'package:compiler/src/commandline_options.dart'; 6 import 'package:compiler/src/commandline_options.dart';
7 import 'package:compiler/src/compiler.dart'; 7 import 'package:compiler/src/compiler.dart';
8 import 'package:compiler/src/elements/elements.dart'; 8 import 'package:compiler/src/elements/elements.dart';
9 import 'package:compiler/src/types/masks.dart'; 9 import 'package:compiler/src/types/masks.dart';
10 import 'package:compiler/src/world.dart' show ClosedWorld;
10 import 'package:expect/expect.dart'; 11 import 'package:expect/expect.dart';
11 import 'memory_compiler.dart'; 12 import 'memory_compiler.dart';
12 import 'type_mask_test_helper.dart'; 13 import 'type_mask_test_helper.dart';
13 14
14 const String SOURCE = ''' 15 const String SOURCE = '''
15 main(args) { 16 main(args) {
16 test0(); 17 test0();
17 test1(args == null); 18 test1(args == null);
18 test2(args == null); 19 test2(args == null);
19 test3(args); 20 test3(args);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 52 }
52 '''; 53 ''';
53 54
54 main() { 55 main() {
55 asyncTest(() async { 56 asyncTest(() async {
56 CompilationResult result = await runCompiler( 57 CompilationResult result = await runCompiler(
57 entryPoint: Uri.parse('memory:main.dart'), 58 entryPoint: Uri.parse('memory:main.dart'),
58 memorySourceFiles: {'main.dart': SOURCE}, 59 memorySourceFiles: {'main.dart': SOURCE},
59 options: [Flags.enableCheckedMode, Flags.enableAssertMessage]); 60 options: [Flags.enableCheckedMode, Flags.enableAssertMessage]);
60 Compiler compiler = result.compiler; 61 Compiler compiler = result.compiler;
62 ClosedWorld closedWorld = compiler.closedWorld;
61 63
62 void check(String methodName, TypeMask expectedReturnType) { 64 void check(String methodName, TypeMask expectedReturnType) {
63 Element element = compiler.mainApp.find(methodName); 65 Element element = compiler.mainApp.find(methodName);
64 TypeMask typeMask = simplify( 66 TypeMask typeMask = simplify(
65 compiler.globalInference.results.resultOf(element).returnType, 67 compiler.globalInference.results.resultOf(element).returnType,
66 compiler); 68 closedWorld);
67 Expect.equals(expectedReturnType, typeMask, 69 Expect.equals(expectedReturnType, typeMask,
68 "Unexpected return type on method '$methodName'."); 70 "Unexpected return type on method '$methodName'.");
69 } 71 }
70 72
71 check('test0', compiler.closedWorld.commonMasks.growableListType); 73 check('test0', closedWorld.commonMasks.growableListType);
72 check('test1', compiler.closedWorld.commonMasks.nullType); 74 check('test1', closedWorld.commonMasks.nullType);
73 check('test2', compiler.closedWorld.commonMasks.uint31Type.nullable()); 75 check('test2', closedWorld.commonMasks.uint31Type.nullable());
74 check('test3', compiler.closedWorld.commonMasks.intType); 76 check('test3', closedWorld.commonMasks.intType);
75 }); 77 });
76 } 78 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/types/masks.dart ('k') | tests/compiler/dart2js/call_site_simple_type_inferer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698