Skip to content

Commit bd751ca

Browse files
committed
Debugging codegen
1 parent b22b4a7 commit bd751ca

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/codegen.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
using GeneralizedGenerated: runtime_eval
3+
using MacroTools: @q
4+
35
function codegen(m::JointDistribution,x)
46
return _codegen(m.model, m.args, x)
57
end
@@ -8,10 +10,17 @@ end
810
type2model(_m) |> sourceCodegen() |> loadvals(_args, _data)
911
end
1012

11-
13+
export sourceCodegen
1214
function sourceCodegen()
1315
function(m::Model)
14-
codegen(symlogpdf(m()))
16+
body = @q begin end
17+
18+
for (x, rhs) in pairs(m.vals)
19+
push!(body.args, :($x = $rhs))
20+
end
21+
22+
push!(body.args, codegen(symlogpdf(m)))
23+
return body
1524
end
1625
end
1726

0 commit comments

Comments
 (0)