Skip to content

Commit

Permalink
better auto type conversion (based on property type)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Oct 10, 2024
1 parent 718786e commit a534c97
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions haxe/ui/macros/ComponentMacros.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1110,9 +1110,15 @@ class ComponentMacros {
propType = propInfo.propertyType;
}
//var propExpr = macro $v{TypeConverter.convertTo(TypeConverter.convertFrom(propValue), propType)};
var pos = Context.currentPos();
var propExpr = macro @:pos(pos) $v{TypeConverter.convertFrom(propValue)};
builder.add(macro $i{varName}.$propName = $propExpr);
if (propType != null) {
var pos = Context.currentPos();
var propExpr = macro @:pos(pos) $v{TypeConverter.convertTo(propValue, propType)};
builder.add(macro $i{varName}.$propName = $propExpr);
} else {
var pos = Context.currentPos();
var propExpr = macro @:pos(pos) $v{TypeConverter.convertFrom(propValue)};
builder.add(macro $i{varName}.$propName = $propExpr);
}
} else {

var propExpr = macro $v{TypeConverter.convertFrom(propValue)};
Expand Down

0 comments on commit a534c97

Please sign in to comment.