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

Side by Side Diff: tests/compiler/dart2js/simple_inferrer_callers_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 // Test that computation of callers of an element works when two 5 // Test that computation of callers of an element works when two
6 // elements of the same name are being invoked in the same method. 6 // elements of the same name are being invoked in the same method.
7 7
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import 'package:compiler/src/inferrer/type_graph_inferrer.dart'; 10 import 'package:compiler/src/inferrer/type_graph_inferrer.dart';
11 import 'package:compiler/src/world.dart' show ClosedWorldRefiner; 11 import 'package:compiler/src/world.dart' show ClosedWorld, ClosedWorldRefiner;
12 12
13 import 'compiler_helper.dart'; 13 import 'compiler_helper.dart';
14 14
15 const String TEST = """ 15 const String TEST = """
16 class A { 16 class A {
17 var field; 17 var field;
18 } 18 }
19 19
20 class B { 20 class B {
21 var field; 21 var field;
(...skipping 11 matching lines...) Expand all
33 MyInferrer(compiler, closedWorld, closedWorldRefiner) 33 MyInferrer(compiler, closedWorld, closedWorldRefiner)
34 : super(compiler, closedWorld, closedWorldRefiner); 34 : super(compiler, closedWorld, closedWorldRefiner);
35 clear() {} 35 clear() {}
36 } 36 }
37 37
38 void main() { 38 void main() {
39 Uri uri = new Uri(scheme: 'source'); 39 Uri uri = new Uri(scheme: 'source');
40 var compiler = compilerFor(TEST, uri, analyzeOnly: true); 40 var compiler = compilerFor(TEST, uri, analyzeOnly: true);
41 asyncTest(() => compiler.run(uri).then((_) { 41 asyncTest(() => compiler.run(uri).then((_) {
42 ClosedWorldRefiner closedWorldRefiner = compiler.closeResolution(); 42 ClosedWorldRefiner closedWorldRefiner = compiler.closeResolution();
43 ClosedWorld closedWorld = compiler.closedWorld;
43 var inferrer = 44 var inferrer =
44 new MyInferrer(compiler, compiler.closedWorld, closedWorldRefiner); 45 new MyInferrer(compiler, closedWorld, closedWorldRefiner);
45 compiler.globalInference.typesInferrerInternal = inferrer; 46 compiler.globalInference.typesInferrerInternal = inferrer;
46 compiler.globalInference.runGlobalTypeInference( 47 compiler.globalInference.runGlobalTypeInference(
47 compiler.mainFunction, compiler.closedWorld, closedWorldRefiner); 48 compiler.mainFunction, closedWorld, closedWorldRefiner);
48 var mainElement = findElement(compiler, 'main'); 49 var mainElement = findElement(compiler, 'main');
49 var classA = findElement(compiler, 'A'); 50 var classA = findElement(compiler, 'A');
50 var fieldA = classA.lookupLocalMember('field'); 51 var fieldA = classA.lookupLocalMember('field');
51 var classB = findElement(compiler, 'B'); 52 var classB = findElement(compiler, 'B');
52 var fieldB = classB.lookupLocalMember('field'); 53 var fieldB = classB.lookupLocalMember('field');
53 54
54 Expect.isTrue(inferrer.getCallersOf(fieldA).contains(mainElement)); 55 Expect.isTrue(inferrer.getCallersOf(fieldA).contains(mainElement));
55 Expect.isTrue(inferrer.getCallersOf(fieldB).contains(mainElement)); 56 Expect.isTrue(inferrer.getCallersOf(fieldB).contains(mainElement));
56 })); 57 }));
57 } 58 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/simple_inferrer_and_or_test.dart ('k') | tests/compiler/dart2js/simple_inferrer_closure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698