From 47cf72d53b985bcc818286a90fdbbaa92f4a9396 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 20 Sep 2024 14:08:08 +0200 Subject: [PATCH] Simplify Event Macro --- .../backend/system/macros/EventMacro.hx | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/source/funkin/backend/system/macros/EventMacro.hx b/source/funkin/backend/system/macros/EventMacro.hx index 810ff1fd..7219a528 100644 --- a/source/funkin/backend/system/macros/EventMacro.hx +++ b/source/funkin/backend/system/macros/EventMacro.hx @@ -75,34 +75,13 @@ class EventMacro { // add a "set this" expr for each variable for(v in values) { var name = v.name; - exprs.push({ - pos: Context.currentPos(), - expr: EBinop(OpAssign, { - pos: Context.currentPos(), - expr: EField({ - pos: Context.currentPos(), - expr: EConst(CIdent("this")) - }, name) - }, { - pos: Context.currentPos(), - expr: EConst(CIdent(name)) - }) - }); + exprs.push(macro this.$name = $i{name}); } // add a "set this" expr to reset each private/hidden variables for(v in hiddenValues) { var name = v.name; - exprs.push({ - pos: Context.currentPos(), - expr: EBinop(OpAssign, { - pos: Context.currentPos(), - expr: EField({ - pos: Context.currentPos(), - expr: EConst(CIdent("this")) - }, name) - }, v.expr) - }); + exprs.push(macro this.$name = ${v.expr}); } exprs.push(macro return this);