From d68d4fd82ea6c4ab85dce8cbddd2c28a2d7c3b0e Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 16 Oct 2024 23:46:17 -0500 Subject: [PATCH] Don't reference possibly computed field twice --- HaxeCBridge.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HaxeCBridge.hx b/HaxeCBridge.hx index 2f267cd..1733b76 100644 --- a/HaxeCBridge.hx +++ b/HaxeCBridge.hx @@ -257,7 +257,7 @@ class HaxeCBridge { meta: [{name: "HaxeCBridge.wrapper", params: [], pos: field.pos}], access: field.access, pos: field.pos, - kind: FFun({ret: TPath({name: "SizeT", pack: ["cpp"]}), params: [], args: [{name: "outPtr", type: ptrT}], expr: macro { if (outPtr != null) { cpp.Pointer.fromRaw(outPtr).set_ref($i{field.name}); } return $i{field.name}.length; } }) + kind: FFun({ret: TPath({name: "SizeT", pack: ["cpp"]}), params: [], args: [{name: "outPtr", type: ptrT}], expr: macro { final x = $i{field.name}; if (outPtr != null) { cpp.Pointer.fromRaw(outPtr).set_ref(x); } return x.length; } }) }); insertTo++; default: @@ -294,7 +294,7 @@ class HaxeCBridge { meta: [{name: "HaxeCBridge.wrapper", params: [], pos: field.pos}], access: field.access, pos: field.pos, - kind: FFun({ret: TPath({name: "SizeT", pack: ["cpp"]}), params: [], args: [{name: "outPtr", type: ptrT}], expr: macro { if (outPtr != null) { cpp.Pointer.fromRaw(outPtr).set_ref($i{field.name}); } return $i{field.name}.length; } }) + kind: FFun({ret: TPath({name: "SizeT", pack: ["cpp"]}), params: [], args: [{name: "outPtr", type: ptrT}], expr: macro { final x = $i{field.name}; if (outPtr != null) { cpp.Pointer.fromRaw(outPtr).set_ref(x); } return x.length; } }) }); insertTo++; default: