Skip to content

Commit

Permalink
The solver constructor also takes max_size and max_depth.
Browse files Browse the repository at this point in the history
This is change is suggested Bart.
  • Loading branch information
nicolaefilat committed Apr 25, 2024
1 parent 5bc88cc commit 3fc8cf7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/program_iterator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@ processdecl(mod::Module, mut::Bool, decl::Expr, super=nothing) = @match decl beg
# this constructor should ONLY be used when there are kwarg fields
# otherwise this will overwrite the default julia struct constructor
solver_constructor = Base.remove_linenums!(:(
# solver main constructor
function $(escaped_name)(solver::Solver, $(notkwargs...) ; $(kwargs_fields...) )
return $(escaped_name)(solver, $(field_names...))
end
# solver main constructor
function $(escaped_name)(solver::Solver, $(notkwargs...) ; max_size = nothing, max_depth = nothing, $(kwargs_fields...) )
if !isnothing(max_size) solver.max_size = max_size end
if !isnothing(max_depth) solver.max_depth = max_depth end
return $(escaped_name)(solver, $(field_names...))
end
))

# create the struct declaration
Expand Down

0 comments on commit 3fc8cf7

Please sign in to comment.