OLD | NEW |
(Empty) | |
| 1 library; |
| 2 import self as self; |
| 3 import "dart:core" as core; |
| 4 |
| 5 abstract class UsedAsBaseClass extends core::Object { |
| 6 constructor •() → void |
| 7 : super core::Object::•() |
| 8 ; |
| 9 abstract method usedInSubclass() → void; |
| 10 method calledFromB() → void { |
| 11 this.{self::UsedAsBaseClass::calledFromSubclass}(); |
| 12 } |
| 13 abstract method calledFromSubclass() → void; |
| 14 } |
| 15 abstract class UsedAsInterface extends core::Object { |
| 16 abstract method usedInSubclass() → void; |
| 17 } |
| 18 class InstantiatedButMethodsUnused extends core::Object { |
| 19 constructor •() → void |
| 20 : super core::Object::•() |
| 21 ; |
| 22 method usedInSubclass() → void |
| 23 throw "Method removed by tree-shaking"; |
| 24 } |
| 25 class ClassA extends self::UsedAsBaseClass implements self::UsedAsInterface, sel
f::InstantiatedButMethodsUnused { |
| 26 constructor •() → void |
| 27 : super self::UsedAsBaseClass::•() |
| 28 ; |
| 29 method usedInSubclass() → void { |
| 30 core::print("A"); |
| 31 } |
| 32 } |
| 33 class ClassB extends self::UsedAsBaseClass implements self::UsedAsInterface, sel
f::InstantiatedButMethodsUnused { |
| 34 constructor •() → void |
| 35 : super self::UsedAsBaseClass::•() |
| 36 ; |
| 37 method usedInSubclass() → void { |
| 38 core::print("B"); |
| 39 this.{self::UsedAsBaseClass::calledFromB}(); |
| 40 } |
| 41 method calledFromSubclass() → void {} |
| 42 } |
| 43 static method baseClassCall(self::UsedAsBaseClass object) → void { |
| 44 object.{self::UsedAsBaseClass::usedInSubclass}(); |
| 45 } |
| 46 static method interfaceCall(self::UsedAsInterface object) → void { |
| 47 object.{self::UsedAsInterface::usedInSubclass}(); |
| 48 } |
| 49 static method exactCallA(self::ClassA object) → void { |
| 50 object.{self::ClassA::usedInSubclass}(); |
| 51 } |
| 52 static method exactCallB(self::ClassB object) → void { |
| 53 object.{self::ClassB::usedInSubclass}(); |
| 54 } |
| 55 static method usedTopLevel() → dynamic {} |
| 56 static method main() → dynamic { |
| 57 self::usedTopLevel(); |
| 58 self::ClassA a = new self::ClassA::•(); |
| 59 self::exactCallA(a); |
| 60 self::baseClassCall(a); |
| 61 self::interfaceCall(a); |
| 62 self::ClassB b = new self::ClassB::•(); |
| 63 self::exactCallB(b); |
| 64 self::baseClassCall(b); |
| 65 self::interfaceCall(b); |
| 66 new self::InstantiatedButMethodsUnused::•(); |
| 67 } |
OLD | NEW |