Skip to content

Commit

Permalink
code readability
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Jun 1, 2024
1 parent 7467f31 commit 2613fbc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/stabilization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ function _stabilize_all(ex::Expr, downward_metadata::DownwardMetadata; kws...)
# We can't track the matches in includes, so just assume
# there are some matches. TODO: However, this is not a great solution.
# Replace include with DispatchDoctor version
return :($(_stabilizing_include)(@__MODULE__, $(ex.args[2]); $(kws)...)), UpwardMetadata(downward_metadata; matching_function=true)
matching_function = true
return :($(_stabilizing_include)(@__MODULE__, $(ex.args[2]); $(kws)...)), UpwardMetadata(downward_metadata; matching_function)
elseif isdef(ex) && @capture(longdef(ex), function (fcall_ | fcall_) body_ end)
# ^ This is the same check done by `splitdef`
# TODO: Should report `isdef` to MacroTools as not capturing all cases
Expand All @@ -198,14 +199,14 @@ function _stabilize_all(ex::Expr, downward_metadata::DownwardMetadata; kws...)
end

function _stabilizing_include(m::Module, path; kws...)
let kws = kws
function inner(ex)
inner = let kws=kws
(ex,) -> let
new_ex, upward_metadata = _stabilize_all(ex, DownwardMetadata(); kws...)
@assert isempty(upward_metadata.unused_macros)
return new_ex
new_ex
end
return m.include(inner, path)
end
return m.include(inner, path)
end

function _stabilize_module(ex, downward_metadata; kws...)
Expand Down

0 comments on commit 2613fbc

Please sign in to comment.