Skip to content

Commit

Permalink
force type definition in @app but not in @handlers call for empty…
Browse files Browse the repository at this point in the history
… variable section
  • Loading branch information
hhaensel committed Nov 25, 2024
1 parent 7ac25cb commit b36eca0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ReactiveTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ function parse_macros(expr::Expr, storage::LittleDict, m::Module)
source = isempty(source) ? "" : last(source)
striplines!(expr)
params = expr.args[2:end]

if fn != :mixin
if length(params) == 1
expr = params
Expand Down Expand Up @@ -636,8 +636,8 @@ macro handlers(typename, expr, handlers_fn_name = :handlers)

filter!(x -> !isa(x, LineNumberNode), initcode)
parse_macros.(initcode, Ref(storage), Ref(__module__))
# if no initcode is provided assume that the model is already defined
initcode_final = isempty(initcode) ? Expr(:block) : :(Stipple.@type($typename, $storage))
# if no initcode is provided and typename is already defined, don't overwrite the existing type and just declare the handlers function
initcode_final = isempty(initcode) && isdefined(__module__, typename) ? Expr(:block) : :(Stipple.@type($typename, $storage))

handlercode_final = []
d = LittleDict(varnames .=> varnames)
Expand Down

0 comments on commit b36eca0

Please sign in to comment.