diff --git a/lib/ControlSystemsBase/src/freqresp.jl b/lib/ControlSystemsBase/src/freqresp.jl index b923e57fd..0206e1074 100644 --- a/lib/ControlSystemsBase/src/freqresp.jl +++ b/lib/ControlSystemsBase/src/freqresp.jl @@ -463,7 +463,7 @@ sys = ss([-1 0; 0 -2], [1 0; 0 1], [1 1; 0 1], 0) sv, w = sigma(sys) ``` """ -@autovec (1) function sigma(sys::LTISystem, w::AbstractVector) +@autovec (1,) function sigma(sys::LTISystem, w::AbstractVector) resp = freqresp(sys, w) ny, nu = size(sys) if ny == 1 || nu == 1 # Shortcut available @@ -476,7 +476,7 @@ sv, w = sigma(sys) end return sv, w end -@autovec (1) sigma(sys::LTISystem) = sigma(sys, _default_freq_vector(sys, Val{:sigma}())) +@autovec (1,) sigma(sys::LTISystem) = sigma(sys, _default_freq_vector(sys, Val{:sigma}())) function _default_freq_vector(systems::Vector{<:LTISystem}, plot; adaptive=false) if adaptive diff --git a/lib/ControlSystemsBase/src/utilities.jl b/lib/ControlSystemsBase/src/utilities.jl index c04c43387..b38912eb1 100644 --- a/lib/ControlSystemsBase/src/utilities.jl +++ b/lib/ControlSystemsBase/src/utilities.jl @@ -155,10 +155,11 @@ the output tuple should be flattened. If the function only has a single output i (not a tuple with a single item) it should be called as `@autovec () f() = ...`. `f()` is the original function and `fv()` will be the version with flattened outputs. """ -macro autovec(indices, f) +macro autovec(indices0, f) dict = MacroTools.splitdef(f) rtype = get(dict, :rtype, :Any) - indices = eval(indices) + MacroTools.@capture indices0 (inds__,) + indices = inds # If indices is empty it means we vec the entire return value if length(indices) == 0