From d5941886ceb5c320ab5f0cad7fcfb3ecffe4e067 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Fri, 23 Dec 2022 21:42:50 +0100 Subject: [PATCH] no more Std.is deprecation warnings --- Project.xml | 1 + buildnumber.txt | 2 +- .../funkin/macros/StdDeprecationsRemover.hx | 26 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 source/funkin/macros/StdDeprecationsRemover.hx diff --git a/Project.xml b/Project.xml index b333df08..1976d3a6 100644 --- a/Project.xml +++ b/Project.xml @@ -150,6 +150,7 @@
+
diff --git a/buildnumber.txt b/buildnumber.txt index 72078b7c..a78eeee4 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1729 \ No newline at end of file +1730 \ No newline at end of file diff --git a/source/funkin/macros/StdDeprecationsRemover.hx b/source/funkin/macros/StdDeprecationsRemover.hx new file mode 100644 index 00000000..1cdee534 --- /dev/null +++ b/source/funkin/macros/StdDeprecationsRemover.hx @@ -0,0 +1,26 @@ +package funkin.macros; + +#if macro +import haxe.macro.Expr; +import haxe.macro.Context; +import haxe.macro.Compiler; + +/** + * Removes all deprecations errors related to `Std.is` + */ +class StdDeprecationsRemover { + public static function init() { + Compiler.addGlobalMetadata('Std', '@:build(hscript.UsingHandler.build())'); + } + + public static function build():Array { + var fields:Array = Context.getBuildFields(); + + for(f in fields) + if (f.name == "is") + f.meta = [for(e in f.meta) if (e.name != ":deprecated") e]; + + return fields; + } +} +#end \ No newline at end of file