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

Unified Diff: pkg/kernel/testcases/input/unused_methods.dart

Issue 2645733004: Run tree shaking in strong-mode baseline tests. (Closed)
Patch Set: Created 3 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: pkg/kernel/testcases/input/unused_methods.dart
diff --git a/pkg/kernel/testcases/input/unused_methods.dart b/pkg/kernel/testcases/input/unused_methods.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5d2c38c06fa927799393b30b5c0eab06da3acda2
--- /dev/null
+++ b/pkg/kernel/testcases/input/unused_methods.dart
@@ -0,0 +1,90 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class UnusedClass {
+ UnusedClass() {
+ print('Unused');
+ }
+}
+
+abstract class UsedAsBaseClass {
+ void usedInSubclass() {
+ print('Unused');
+ }
+
+ void calledFromB() {
+ this.calledFromSubclass();
+ }
+
+ void calledFromSubclass() {
+ print('Unused');
+ }
+}
+
+class UsedAsInterface {
+ void usedInSubclass() {
+ print('Unused');
+ }
+}
+
+class InstantiatedButMethodsUnused {
+ void usedInSubclass() {
+ print('Unused');
+ }
+}
+
+class ClassA extends UsedAsBaseClass
+ implements UsedAsInterface, InstantiatedButMethodsUnused {
+ void usedInSubclass() {
+ print('A');
+ }
+}
+
+class ClassB extends UsedAsBaseClass
+ implements UsedAsInterface, InstantiatedButMethodsUnused {
+ void usedInSubclass() {
+ print('B');
+ calledFromB();
+ }
+
+ void calledFromSubclass() {}
+}
+
+void baseClassCall(UsedAsBaseClass object) {
+ object.usedInSubclass();
+}
+
+void interfaceCall(UsedAsInterface object) {
+ object.usedInSubclass();
+}
+
+void exactCallA(ClassA object) {
+ object.usedInSubclass();
+}
+
+void exactCallB(ClassB object) {
+ object.usedInSubclass();
+}
+
+unusedTopLevel() {
+ print('Unused');
+}
+
+usedTopLevel() {}
+
+main() {
+ usedTopLevel();
+
+ ClassA a = new ClassA();
+ exactCallA(a);
+ baseClassCall(a);
+ interfaceCall(a);
+
+ ClassB b = new ClassB();
+ exactCallB(b);
+ baseClassCall(b);
+ interfaceCall(b);
+
+ new InstantiatedButMethodsUnused();
+}
« no previous file with comments | « pkg/kernel/test/baseline_strong_mode_test.dart ('k') | pkg/kernel/testcases/spec-mode/unused_methods.baseline.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698