build macro

This commit is contained in:
lemz1 2024-10-27 01:56:50 +02:00 committed by lemz
parent b26b1bf4e8
commit c75112b998
3 changed files with 7 additions and 2 deletions

View file

@ -588,7 +588,6 @@ class Project extends HXProject {
function configureCustomMacros() {
// This macro allows addition of new functionality to existing Flixel. -->
addHaxeMacro("addMetadata('@:build(funkin.util.macro.FlxMacro.buildFlxBasic())', 'flixel.FlxBasic')");
addHaxeMacro("funkin.util.macro.PolymodMacro.buildPolymodAbstracts()");
}
function configureOutputDir() {

View file

@ -24,6 +24,7 @@ import polymod.Polymod;
/**
* A class for interacting with Polymod, the atomic modding framework for Haxe.
*/
@:build(funkin.util.macro.PolymodMacro.buildPolymodAbstracts())
class PolymodHandler
{
/**

View file

@ -8,8 +8,10 @@ using StringTools;
class PolymodMacro
{
public static macro function buildPolymodAbstracts():Void
public static macro function buildPolymodAbstracts():Array<Field>
{
var fields:Array<Field> = Context.getBuildFields();
Context.onAfterTyping((types) -> {
for (type in types)
{
@ -17,11 +19,14 @@ class PolymodMacro
{
case ModuleType.TAbstract(a):
var cls = a.get();
trace(cls.name);
default:
// do nothing
}
}
});
return fields;
}
#if macro