Compare commits

..

24 commits

Author SHA1 Message Date
lemz
4a11e3ec78
Merge e9a1ee42b2 into 0d8e4a5330 2024-10-30 20:01:03 +00:00
lemz1
e9a1ee42b2 let the compiler figure out the type 2024-10-30 21:01:00 +01:00
lemz1
9ee4b0b94e no more checkstyle warnings 2024-10-30 21:01:00 +01:00
lemz1
907f300267 a bit nicer syntax 2024-10-30 21:01:00 +01:00
lemz1
ba1dbb5f68 all haxe abstracts 2024-10-30 21:01:00 +01:00
lemz1
d27433318d Update PolymodMacro.hx 2024-10-30 21:01:00 +01:00
lemz1
ee63e8d8d6 check for private abstracts 2024-10-30 21:01:00 +01:00
lemz1
ba72fee609 basically the most important abstracts 2024-10-30 21:01:00 +01:00
lemz1
42d93c616a lets make flxsignal an edge-case and use dynamic normally 2024-10-30 21:01:00 +01:00
lemz1
374f6837eb remove this useless vars 2024-10-30 21:01:00 +01:00
lemz1
f3b4cac92d make things dynamic (this is because typeparameters cause problems) 2024-10-30 21:01:00 +01:00
lemz1
918292d5a8 create abstracts for all specified modules 2024-10-30 21:01:00 +01:00
lemz1
07749285f1 flxsignal works now
i just need to make it work for all abstracts
2024-10-30 21:01:00 +01:00
lemz1
dcc58e9e33 polymod aliases 2024-10-30 21:01:00 +01:00
lemz1
6d35d07245 Update PolymodMacro.hx 2024-10-30 21:01:00 +01:00
lemz1
807373c2d2 lol 2024-10-30 21:01:00 +01:00
lemz1
c75112b998 build macro 2024-10-30 21:01:00 +01:00
lemz1
b26b1bf4e8 TODO: build specified abstracts 2024-10-30 21:01:00 +01:00
lemz1
0e36e9261d abstract without to and from should work now 2024-10-30 21:01:00 +01:00
lemz1
c00e4e8316 forgot that TType exists as well 2024-10-30 21:01:00 +01:00
lemz1
2d68f60c9b Update PolymodMacro.hx 2024-10-30 21:01:00 +01:00
lemz1
a01a5907e7 use module 2024-10-30 21:01:00 +01:00
lemz1
ad23a1c6d0 static member variables retrieved using getters 2024-10-30 21:01:00 +01:00
lemz1
d105686251 abstracts 2024-10-30 21:01:00 +01:00
2 changed files with 22 additions and 17 deletions

View file

@ -590,9 +590,11 @@ class Project extends HXProject {
addHaxeMacro("addMetadata('@:build(funkin.util.macro.FlxMacro.buildFlxBasic())', 'flixel.FlxBasic')");
var abstracts:Array<String> = [
'funkin.*',
'flixel.*',
'haxe.*'
'.*',
'!thx.Set',
'!cpp.*',
'!lime.*',
'!openfl.*'
];
addHaxeMacro("funkin.util.macro.PolymodMacro.buildPolymodAbstracts(['" + abstracts.join("', '") + "'])");
}

View file

@ -86,7 +86,7 @@ class PolymodMacro
}
}
abstractAliases.set('${packTypePath(cls)}', 'polymod.abstracts.${packTypePath(cls)}');
abstractAliases.set('${packTypePath(cls)}', 'polymod.abstracts.${packTypePath(cls)}${classSuffix}');
buildAbstract(cls);
break;
}
@ -126,6 +126,7 @@ class PolymodMacro
}
#if macro
static var classSuffix:String = '_';
static var alreadyCalled:Bool = false;
static var skipFields:Array<String> = [];
@ -160,7 +161,7 @@ class PolymodMacro
{
pos: Context.currentPos(),
pack: ['polymod', 'abstracts'].concat(abstractCls.pack),
name: abstractCls.name,
name: abstractCls.name + classSuffix,
kind: TypeDefKind.TDClass(null, [], false, false, false),
fields: fields,
}, null);
@ -202,7 +203,7 @@ class PolymodMacro
funcArgs.push(
{
name: arg.name,
type: (macro :Dynamic),
type: null,
opt: arg.opt
});
funcArgNames.push(arg.name);
@ -219,7 +220,7 @@ class PolymodMacro
kind: FieldType.FFun(
{
args: funcArgs,
ret: (macro :Dynamic),
ret: null,
expr: macro
{
@:privateAccess
@ -290,23 +291,25 @@ class PolymodMacro
fieldArgs.push(
{
name: arg.name,
type: (macro :Dynamic),
type: null,
opt: arg.opt,
});
}
var returnStr:String = 'return ';
var returnType:ComplexType = (macro :Dynamic);
switch (ret)
var returnStr:String = switch (ret)
{
case Type.TAbstract(t, _):
if (t.get().name == 'Void')
{
returnStr = '';
returnType = (macro :Void);
'';
}
else
{
'return ';
}
default:
}
'return ';
};
var expr:String = '${returnStr}${moduleTypePath(cls)}.${field.name}(${exprArgs.join(', ')})';
@ -318,7 +321,7 @@ class PolymodMacro
kind: FieldType.FFun(
{
args: fieldArgs,
ret: returnType,
ret: null,
expr: macro
{
@:privateAccess
@ -348,7 +351,7 @@ class PolymodMacro
kind: FieldType.FFun(
{
args: [],
ret: (macro :Dynamic),
ret: null,
expr: macro
{
@:privateAccess
@ -378,7 +381,7 @@ class PolymodMacro
kind: FieldType.FFun(
{
args: [],
ret: (macro :Dynamic),
ret: null,
expr: macro
{
@:privateAccess