diff --git a/src/variables.jl b/src/variables.jl index af360ae62ff232c7a2d374c7e1b4346e7c239b8e..3d0df17b96b0a1bf3250bee3ac743afbe8520f4d 100644 --- a/src/variables.jl +++ b/src/variables.jl @@ -127,6 +127,9 @@ function _defvar(func_def, getter=nothing) end function adjust_function(ex) + if ex isa Expr && ex.head == :block + return Expr(:block, adjust_function.(ex.args)...) + end if ex isa Expr && ex.head == :function && length(ex.args) == 1 push!(func_names, ex.args[1]) return :nothing @@ -148,7 +151,7 @@ function _defvar(func_def, getter=nothing) rethrow() end end - new_func_def = MacroTools.postwalk(adjust_function, func_def) + new_func_def = adjust_function(func_def) function fix_function_name(ex) if ex in func_names