Skip to content

Commit 679a435

Browse files
MAJigsaw77Hundrec
authored andcommitted
Fix FlxMacro from breaking the completion server.
1 parent d1a085d commit 679a435

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

source/funkin/util/macro/FlxMacro.hx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,30 @@ class FlxMacro
1818
var fields:Array<haxe.macro.Expr.Field> = haxe.macro.Context.getBuildFields();
1919

2020
// haxe.macro.Context.info('[INFO] ${cls.name}: Adding zIndex attribute...', pos);
21+
var hasZIndex = false;
2122

22-
// Here, we add the zIndex attribute to all FlxBasic objects.
23-
// This has no functional code tied to it, but it can be used as a target value
24-
// for the FlxTypedGroup.sort method, to rearrange the objects in the scene.
25-
fields = fields.concat([
23+
for (f in fields)
24+
{
25+
if (f.name == "zIndex")
2626
{
27-
name: "zIndex", // Field name.
28-
access: [haxe.macro.Expr.Access.APublic], // Access level
29-
kind: haxe.macro.Expr.FieldType.FVar(macro :Int, macro $v{0}), // Variable type and default value
30-
pos: pos, // The field's position in code.
27+
hasZIndex = true;
28+
break;
3129
}
32-
]);
30+
}
31+
32+
if (!hasZIndex)
33+
{
34+
// Here, we add the zIndex attribute to all FlxBasic objects.
35+
// This has no functional code tied to it, but it can be used as a target value
36+
// for the FlxTypedGroup.sort method, to rearrange the objects in the scene.
37+
fields.push(
38+
{
39+
name: "zIndex", // Field name.
40+
access: [haxe.macro.Expr.Access.APublic], // Access level
41+
kind: haxe.macro.Expr.FieldType.FVar(macro :Int, macro $v{0}), // Variable type and default value
42+
pos: pos, // The field's position in code.
43+
});
44+
}
3345

3446
return fields;
3547
}

0 commit comments

Comments
 (0)