@@ -772,18 +772,17 @@ function Base.names(model::Model)
772772 map (first, get (model. structure, :components , EMPTY_VoVoSYMBOL))))
773773end
774774
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 )
776776 extend_args! (a, b, dict, expr, kwargs)
777777
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
779779 # `nothing` for explicit destructuring.
780780 # The following block modifies the arguments of both base and higher systems
781781 # for the implicit extend statements.
782- if additional_args != = nothing
782+ if implicit_arglist != = nothing
783783 b. args = [b. args[1 ]]
784- allvars = [additional_args. args... , vars. args... ]
785784 push! (b. args, Expr (:parameters ))
786- for var in allvars
785+ for var in implicit_arglist . args
787786 push! (b. args[end ]. args, var)
788787 if ! haskey (dict[:kwargs ], var)
789788 push! (dict[:kwargs ], var => Dict (:value => NO_VALUE))
@@ -814,8 +813,8 @@ function parse_extend!(exprs, ext, dict, mod, body, kwargs)
814813 end
815814 a, b = b. args
816815 # 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 )
819818 else
820819 error (" When explicitly destructing in `@extend` please use the syntax: `@extend a, b = oneport = OnePort()`." )
821820 end
@@ -825,11 +824,12 @@ function parse_extend!(exprs, ext, dict, mod, body, kwargs)
825824 b = body
826825 if (model = getproperty (mod, b. args[1 ])) isa Model
827826 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,
831831 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 )
833833 else
834834 error (" Cannot infer the exact `Model` that `@extend $(body) ` refers." *
835835 " Please specify the names that it brings into scope by:" *
0 commit comments