Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/SomeRanDev/reflaxe
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeRanDev committed Apr 6, 2024
2 parents 4516a5a + 7bc1352 commit 3041537
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/reflaxe/compiler/RepeatVariableFixer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3041537

Please sign in to comment.