From 71f31cb553933f4105b080968aa6119b391d67cc Mon Sep 17 00:00:00 2001 From: Peter Deffebach Date: Wed, 26 Jun 2024 18:50:21 -0400 Subject: [PATCH] fix --- src/macros.jl | 1 - src/parsing.jl | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/macros.jl b/src/macros.jl index 855714ef..acb8ebc1 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -759,7 +759,6 @@ write function subset_helper(x, args...) x, exprs, outer_flags, kw = get_df_args_kwargs(x, args...; wrap_byrow = false) - t = (fun_to_vec(ex; no_dest=true, outer_flags=outer_flags) for ex in exprs) quote $subset($x, $(t...); (skipmissing = true,)..., $(kw...)) diff --git a/src/parsing.jl b/src/parsing.jl index a431ec68..00bff676 100644 --- a/src/parsing.jl +++ b/src/parsing.jl @@ -545,20 +545,20 @@ function create_args_vector!(kw, arg; wrap_byrow::Bool=false) end # @astable means the whole block is one transformation + if arg isa Expr && arg.head == :block && !outer_flags[ASTABLE_SYM][] x = MacroTools.rmlines(arg).args - kw = [] transforms = [] - seen_kw = false + seen_kw = !isempty(kw) for xi in x if is_macro_head(xi, "@kwarg") + if seen_kw + throw(ArgumentError("@kwarg calls must be at end of block")) + end kw_item = get_kw_from_macro_call(xi) push!(kw, kw_item) seen_kw = true else - if seen_kw - throw(ArgumentError("@kwarg calls must be at end of block")) - end push!(transforms, xi) end end