123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- class Main {
- static function main() {
- // deprecating type objects work
- MyClass;
- MyInterface;
- MyEnum;
- // MyAbstract; // this compiles when analyzer=yes, but is another issue
- TClass;
- TInterface;
- TEnum;
- // TAbstract; // this compiles when analyzer=yes, but is another issue
- // TAnon; // this won't and shouldn't compile anyway
- // deprecating types instantiated work
- new MyClass();
- MyEnum.None;
- new MyAbstract(null); // but doesn't work on abstracts...
- new TClass();
- TEnum.None;
- new TAbstract(null); // neither
- // some physical access to deprecated API
- deprecatedField;
- deprecatedFunc();
- deprecatedProperty; // this won't show warnings
- var x = deprecatedProperty; // this also
- deprecatedGetSet; // however this will
- var x = deprecatedGetSet; // this also
- // the enum @:deprecated trumps the enum field one... should be fine
- switch (None) {
- case None:
- }
- switch (None2) {
- case None2:
- }
- }
- // deprecating fields work
- @:deprecated static var deprecatedField:String;
- @:deprecated static function deprecatedFunc() return;
- // ... however deprecating getters and setters have some gotcha
- @:deprecated static var deprecatedProperty(get, set):String;
- static function get_deprecatedProperty():String return "0";
- static function set_deprecatedProperty(_):String return "0";
- static var deprecatedGetSet(get, set):String;
- @:deprecated static function get_deprecatedGetSet():String return "0";
- @:deprecated static function set_deprecatedGetSet(_):String return "0";
- }
- @:deprecated
- class MyClass { public function new() {} }
- @:deprecated
- interface MyInterface { }
- @:deprecated
- enum MyEnum { @:deprecated None; }
- enum MyEnum2 { @:deprecated None2; }
- @:deprecated
- abstract MyAbstract(String) { public function new(value:String) this = value; }
- @:deprecated
- typedef TClass = MyClass;
- @:deprecated
- typedef TInterface = MyInterface;
- @:deprecated
- typedef TEnum = MyEnum;
- @:deprecated
- typedef TAbstract = MyAbstract;
- @:deprecated
- typedef TAnon = { a:String };
|