OLD | NEW |
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'; |
(...skipping 30 matching lines...) Expand all Loading... |
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 = | 43 ClosedWorld closedWorld = |
44 compiler.resolutionWorldBuilder.closedWorldForTesting; | 44 compiler.resolutionWorldBuilder.closedWorldForTesting; |
45 var inferrer = | 45 var inferrer = |
46 new MyInferrer(compiler, closedWorld, closedWorldRefiner); | 46 new MyInferrer(compiler, closedWorld, closedWorldRefiner); |
47 compiler.globalInference.typesInferrerInternal = inferrer; | 47 compiler.globalInference.typesInferrerInternal = inferrer; |
48 compiler.globalInference.runGlobalTypeInference( | 48 compiler.globalInference.runGlobalTypeInference( |
49 compiler.mainFunction, closedWorld, closedWorldRefiner); | 49 compiler.mainFunction, closedWorld, closedWorldRefiner); |
50 var mainElement = findElement(compiler, 'main'); | 50 var mainElement = findElement(compiler, 'main'); |
51 var classA = findElement(compiler, 'A'); | 51 dynamic classA = findElement(compiler, 'A'); |
52 var fieldA = classA.lookupLocalMember('field'); | 52 var fieldA = classA.lookupLocalMember('field'); |
53 var classB = findElement(compiler, 'B'); | 53 dynamic classB = findElement(compiler, 'B'); |
54 var fieldB = classB.lookupLocalMember('field'); | 54 var fieldB = classB.lookupLocalMember('field'); |
55 | 55 |
56 Expect.isTrue(inferrer.getCallersOf(fieldA).contains(mainElement)); | 56 Expect.isTrue(inferrer.getCallersOf(fieldA).contains(mainElement)); |
57 Expect.isTrue(inferrer.getCallersOf(fieldB).contains(mainElement)); | 57 Expect.isTrue(inferrer.getCallersOf(fieldB).contains(mainElement)); |
58 })); | 58 })); |
59 } | 59 } |
OLD | NEW |