Skip to content

Use getsym instead of an explicitly generated function and avoid writeback if nothing is returned #3610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Forgot readback
  • Loading branch information
BenChung committed May 8, 2025
commit 51acbfb34e0c88ae5fffbac23fa153c6de492cdc
8 changes: 8 additions & 0 deletions src/systems/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,14 @@ end
end)
end

@generated function _generated_readback(integ, getters::NamedTuple{NS1, <:Tuple}) where {NS1}
getter_exprs = []
for name in NS1
push!(getter_exprs, :($name = getters.$name(integ)))
end
return :((; $(getter_exprs...)))
end

function check_assignable(sys, sym)
if symbolic_type(sym) == ScalarSymbolic()
is_variable(sys, sym) || is_parameter(sys, sym)
Expand Down
Loading