Skip to content

Commit

Permalink
Small macro hygiene fixes (#384)
Browse files Browse the repository at this point in the history
* small hygiene fixes

* More hygiene fixes
  • Loading branch information
pdeffebach authored Mar 1, 2024
1 parent 28bfa4d commit 4f482da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ function with_helper(d, body)
# complicated method of fun_to_vec
# in the case of QuoteNode
t = fun_to_vec(Expr(:block, body); no_dest=true)
:(DataFramesMeta.exec($d, $t))
:($exec($d, $t))
end

"""
Expand Down Expand Up @@ -2453,7 +2453,7 @@ function distinct_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
$DataFramesMeta.make_distinct($x, $(t...); $(kw...))
$make_distinct($x, $(t...); $(kw...))
end
end

Expand Down Expand Up @@ -2560,7 +2560,7 @@ function rdistinct_helper(x, args...)
x, exprs, outer_flags, kw = get_df_args_kwargs(x, args...; wrap_byrow = true)
t = (fun_to_vec(ex; no_dest = true, outer_flags=outer_flags) for ex in exprs)
quote
$DataFramesMeta.make_distinct($x, $(t...); $(kw...))
$make_distinct($x, $(t...); $(kw...))
end
end

Expand Down Expand Up @@ -2620,7 +2620,7 @@ function distinct!_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
$DataFramesMeta.make_distinct!($x, $(t...); $(kw...))
$make_distinct!($x, $(t...); $(kw...))
end
end

Expand Down Expand Up @@ -2732,7 +2732,7 @@ function rdistinct!_helper(x, args...)
x, exprs, outer_flags, kw = get_df_args_kwargs(x, args...; wrap_byrow = true)
t = (fun_to_vec(ex; no_dest = true, outer_flags=outer_flags) for ex in exprs)
quote
$DataFramesMeta.make_distinct!($x, $(t...); $(kw...))
$make_distinct!($x, $(t...); $(kw...))
end
end

Expand Down
6 changes: 3 additions & 3 deletions src/parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function args_to_selectors(v)
col
end

:(DataFramesMeta.make_source_concrete($(Expr(:vect, t...))))
:($make_source_concrete($(Expr(:vect, t...))))
end

is_macro_head(ex, name) = false
Expand Down Expand Up @@ -280,7 +280,7 @@ function get_source_fun(function_expr; exprflags = deepcopy(DEFAULT_FLAGS))
source = args_to_selectors(function_expr.args[2:end])
fun_t = function_expr.args[1]

# .+ to +
# .+ to Expr(:., +)
fun = fix_simple_dot(fun_t)
elseif is_simple_broadcast_call(function_expr)
# extract source symbols from quotenodes
Expand All @@ -296,7 +296,7 @@ function get_source_fun(function_expr; exprflags = deepcopy(DEFAULT_FLAGS))
membernames = Dict{Any, Symbol}()

body = replace_syms!(membernames, function_expr)
source = :(DataFramesMeta.make_source_concrete($(Expr(:vect, keys(membernames)...))))
source = :($make_source_concrete($(Expr(:vect, keys(membernames)...))))
inputargs = Expr(:tuple, values(membernames)...)
fun = quote
$inputargs -> begin
Expand Down
4 changes: 2 additions & 2 deletions src/parsing_astable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ function get_source_fun_astable(ex; exprflags = deepcopy(DEFAULT_FLAGS))
replace_syms_astable!(inputs_to_function, lhs_assignments, arg)
end
end
source = :(DataFramesMeta.make_source_concrete($(Expr(:vect, keys(inputs_to_function)...))))
source = :($make_source_concrete($(Expr(:vect, keys(inputs_to_function)...))))

inputargs = Expr(:tuple, values(inputs_to_function)...)
nt_iterator = (:(DataFramesMeta.sym_or_str_to_sym($k) => $v) for (k, v) in lhs_assignments)
nt_iterator = (:($sym_or_str_to_sym($k) => $v) for (k, v) in lhs_assignments)
nt_expr = Expr(:tuple, Expr(:parameters, nt_iterator...))

body = Expr(:block, Expr(:block, exprs...), nt_expr)
Expand Down

0 comments on commit 4f482da

Please sign in to comment.