OLD | NEW |
| (Empty) |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 class UnusedClass { | |
6 UnusedClass() { | |
7 print('Unused'); | |
8 } | |
9 } | |
10 | |
11 abstract class UsedAsBaseClass { | |
12 void usedInSubclass() { | |
13 print('Unused'); | |
14 } | |
15 | |
16 void calledFromB() { | |
17 this.calledFromSubclass(); | |
18 } | |
19 | |
20 void calledFromSubclass() { | |
21 print('Unused'); | |
22 } | |
23 } | |
24 | |
25 class UsedAsInterface { | |
26 void usedInSubclass() { | |
27 print('Unused'); | |
28 } | |
29 } | |
30 | |
31 class InstantiatedButMethodsUnused { | |
32 void usedInSubclass() { | |
33 print('Unused'); | |
34 } | |
35 } | |
36 | |
37 class ClassA extends UsedAsBaseClass | |
38 implements UsedAsInterface, InstantiatedButMethodsUnused { | |
39 void usedInSubclass() { | |
40 print('A'); | |
41 } | |
42 } | |
43 | |
44 class ClassB extends UsedAsBaseClass | |
45 implements UsedAsInterface, InstantiatedButMethodsUnused { | |
46 void usedInSubclass() { | |
47 print('B'); | |
48 calledFromB(); | |
49 } | |
50 | |
51 void calledFromSubclass() {} | |
52 } | |
53 | |
54 void baseClassCall(UsedAsBaseClass object) { | |
55 object.usedInSubclass(); | |
56 } | |
57 | |
58 void interfaceCall(UsedAsInterface object) { | |
59 object.usedInSubclass(); | |
60 } | |
61 | |
62 void exactCallA(ClassA object) { | |
63 object.usedInSubclass(); | |
64 } | |
65 | |
66 void exactCallB(ClassB object) { | |
67 object.usedInSubclass(); | |
68 } | |
69 | |
70 unusedTopLevel() { | |
71 print('Unused'); | |
72 } | |
73 | |
74 usedTopLevel() {} | |
75 | |
76 main() { | |
77 usedTopLevel(); | |
78 | |
79 ClassA a = new ClassA(); | |
80 exactCallA(a); | |
81 baseClassCall(a); | |
82 interfaceCall(a); | |
83 | |
84 ClassB b = new ClassB(); | |
85 exactCallB(b); | |
86 baseClassCall(b); | |
87 interfaceCall(b); | |
88 | |
89 new InstantiatedButMethodsUnused(); | |
90 } | |
OLD | NEW |