Skip to content

Commit

Permalink
allow @:value aliasing to work with sub components
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Aug 19, 2024
1 parent 02fc0f8 commit 477a361
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions haxe/ui/macros/Macros.hx
Original file line number Diff line number Diff line change
Expand Up @@ -848,12 +848,20 @@ class Macros {
}, false, true);
}
} else {
var getterExpr = macro this.$propName;
var setterExpr = macro this.$propName = value;
var parts = propName.split(".");
if (parts.length > 1) {
propName = parts[1];
getterExpr = macro $i{parts[0]}.$propName;
setterExpr = macro $i{parts[0]}.$propName = value;
}
builder.addGetter(f.name, macro: Dynamic, macro {
return $i{propName};
return $e{getterExpr};
}, false, true);

builder.addSetter(f.name, macro: Dynamic, macro {
$i{propName} = value;
this.$propName = value;
return value;
}, false, true);
}
Expand Down

0 comments on commit 477a361

Please sign in to comment.