From f8112f637e6b28d97cb08e359de784ea3431b700 Mon Sep 17 00:00:00 2001 From: fourst4r Date: Sun, 11 Feb 2024 20:24:50 +1300 Subject: [PATCH] Map exprs without skipping the first one --- src/reflaxe/compiler/RepeatVariableFixer.hx | 23 +++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/reflaxe/compiler/RepeatVariableFixer.hx b/src/reflaxe/compiler/RepeatVariableFixer.hx index ada68ca..cdb5c92 100644 --- a/src/reflaxe/compiler/RepeatVariableFixer.hx +++ b/src/reflaxe/compiler/RepeatVariableFixer.hx @@ -112,23 +112,20 @@ class RepeatVariableFixer { } function handleExpression(expr: TypedExpr): TypedExpr { - function mapSubExprs(subExpr: TypedExpr) { - switch(subExpr.expr) { - case TBlock(_): { - return handleBlock(subExpr); - } - case TLocal(tvar): { - final replacement = varReplacement(tvar.id); - if(replacement != null) { - return subExpr.copy(TLocal(replacement)); - } + switch(expr.expr) { + case TBlock(_): { + return handleBlock(expr); + } + case TLocal(tvar): { + final replacement = varReplacement(tvar.id); + if(replacement != null) { + return expr.copy(TLocal(replacement)); } - case _: } - return haxe.macro.TypedExprTools.map(subExpr, mapSubExprs); + case _: } - return haxe.macro.TypedExprTools.map(expr, mapSubExprs); + return haxe.macro.TypedExprTools.map(expr, handleExpression); } function handleBlock(subExpr: TypedExpr): TypedExpr {