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'; | |
9 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
| 9 import "package:async_helper/async_helper.dart"; |
| 10 import 'package:compiler/src/types/types.dart'; |
10 import 'package:compiler/src/inferrer/type_graph_inferrer.dart'; | 11 import 'package:compiler/src/inferrer/type_graph_inferrer.dart'; |
11 | 12 |
12 import 'compiler_helper.dart'; | 13 import 'compiler_helper.dart'; |
| 14 import 'parser_helper.dart'; |
13 | 15 |
14 const String TEST = """ | 16 const String TEST = """ |
15 class A { | 17 class A { |
16 var field; | 18 var field; |
17 } | 19 } |
18 | 20 |
19 class B { | 21 class B { |
20 var field; | 22 var field; |
21 } | 23 } |
22 | 24 |
(...skipping 19 matching lines...) Expand all Loading... |
42 var mainElement = findElement(compiler, 'main'); | 44 var mainElement = findElement(compiler, 'main'); |
43 var classA = findElement(compiler, 'A'); | 45 var classA = findElement(compiler, 'A'); |
44 var fieldA = classA.lookupLocalMember('field'); | 46 var fieldA = classA.lookupLocalMember('field'); |
45 var classB = findElement(compiler, 'B'); | 47 var classB = findElement(compiler, 'B'); |
46 var fieldB = classB.lookupLocalMember('field'); | 48 var fieldB = classB.lookupLocalMember('field'); |
47 | 49 |
48 Expect.isTrue(inferrer.getCallersOf(fieldA).contains(mainElement)); | 50 Expect.isTrue(inferrer.getCallersOf(fieldA).contains(mainElement)); |
49 Expect.isTrue(inferrer.getCallersOf(fieldB).contains(mainElement)); | 51 Expect.isTrue(inferrer.getCallersOf(fieldB).contains(mainElement)); |
50 })); | 52 })); |
51 } | 53 } |
OLD | NEW |