From bea48d8156fbff59a277a6e81183bf371dc9d8b7 Mon Sep 17 00:00:00 2001 From: Christian Guinard <28689358+christiangnrd@users.noreply.github.com> Date: Tue, 10 Dec 2024 11:06:10 -0400 Subject: [PATCH] More hacks! --- lib/mtl/libmtl.jl | 15 +++------------ res/wrap/wrap.jl | 4 ++++ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/mtl/libmtl.jl b/lib/mtl/libmtl.jl index 54793b7d..e17ab6b0 100644 --- a/lib/mtl/libmtl.jl +++ b/lib/mtl/libmtl.jl @@ -20,29 +20,20 @@ struct MTLOrigin x::NSUInteger y::NSUInteger z::NSUInteger - MTLOrigin(x = 0, y = 0, z = 0) = begin - #= none:1 =# - new(x, y, z) - end + MTLOrigin(x = 0, y = 0, z = 0) = new(x, y, z) end struct MTLSize width::NSUInteger height::NSUInteger depth::NSUInteger - MTLSize(w = 1, h = 1, d = 1) = begin - #= none:1 =# - new(w, h, d) - end + MTLSize(w = 1, h = 1, d = 1) = new(w, h, d) end struct MTLRegion origin::MTLOrigin size::MTLSize - MTLRegion(origin = MTLOrigin(), size = MTLSize()) = begin - #= none:1 =# - new(origin, size) - end + MTLRegion(origin = MTLOrigin(), size = MTLSize()) = new(origin, size) end struct MTLSamplePosition diff --git a/res/wrap/wrap.jl b/res/wrap/wrap.jl index 7f85bc55..756c7fca 100644 --- a/res/wrap/wrap.jl +++ b/res/wrap/wrap.jl @@ -210,6 +210,10 @@ function rewriter!(ctx, options) expr = node.exprs[1] con = options["api"][structName]["constructor"] |> Meta.parse + if con.head == :(=) && con.args[2] isa Expr && con.args[2].head == :block && + con.args[2].args[1] isa LineNumberNode && con.args[2].args[2].head == :call + con.args[2] = con.args[2].args[2] + end push!(expr.args[3].args, con) end end