@@ -772,18 +772,17 @@ function Base.names(model::Model)
772
772
map (first, get (model. structure, :components , EMPTY_VoVoSYMBOL))))
773
773
end
774
774
775
- function _parse_extend! (ext, a, b, dict, expr, kwargs, vars, additional_args )
775
+ function _parse_extend! (ext, a, b, dict, expr, kwargs, vars, implicit_arglist )
776
776
extend_args! (a, b, dict, expr, kwargs)
777
777
778
- # `additional_args ` doubles as a flag to check the mode of `@extend`. It is
778
+ # `implicit_arglist ` doubles as a flag to check the mode of `@extend`. It is
779
779
# `nothing` for explicit destructuring.
780
780
# The following block modifies the arguments of both base and higher systems
781
781
# for the implicit extend statements.
782
- if additional_args != = nothing
782
+ if implicit_arglist != = nothing
783
783
b. args = [b. args[1 ]]
784
- allvars = [additional_args. args... , vars. args... ]
785
784
push! (b. args, Expr (:parameters ))
786
- for var in allvars
785
+ for var in implicit_arglist . args
787
786
push! (b. args[end ]. args, var)
788
787
if ! haskey (dict[:kwargs ], var)
789
788
push! (dict[:kwargs ], var => Dict (:value => NO_VALUE))
@@ -814,8 +813,8 @@ function parse_extend!(exprs, ext, dict, mod, body, kwargs)
814
813
end
815
814
a, b = b. args
816
815
# This doubles as a flag to identify the mode of `@extend`
817
- additional_args = nothing
818
- _parse_extend! (ext, a, b, dict, expr, kwargs, vars, additional_args )
816
+ implicit_arglist = nothing
817
+ _parse_extend! (ext, a, b, dict, expr, kwargs, vars, implicit_arglist )
819
818
else
820
819
error (" When explicitly destructing in `@extend` please use the syntax: `@extend a, b = oneport = OnePort()`." )
821
820
end
@@ -825,11 +824,12 @@ function parse_extend!(exprs, ext, dict, mod, body, kwargs)
825
824
b = body
826
825
if (model = getproperty (mod, b. args[1 ])) isa Model
827
826
vars = Expr (:tuple )
828
- append! (vars. args, _arguments (model))
829
- additional_args = Expr (:tuple )
830
- append! (additional_args. args,
827
+ append! (vars. args, names (model))
828
+ implicit_arglist = Expr (:tuple )
829
+ append! (implicit_arglist. args, _arguments (model))
830
+ append! (implicit_arglist. args,
831
831
keys (get (model. structure, :structural_parameters , EMPTY_DICT)))
832
- _parse_extend! (ext, a, b, dict, expr, kwargs, vars, additional_args )
832
+ _parse_extend! (ext, a, b, dict, expr, kwargs, vars, implicit_arglist )
833
833
else
834
834
error (" Cannot infer the exact `Model` that `@extend $(body) ` refers." *
835
835
" Please specify the names that it brings into scope by:" *
0 commit comments