From 4d63fb5993f953fd455bb8809daeb3b02c6a096b Mon Sep 17 00:00:00 2001 From: Chad Scherrer Date: Sat, 29 May 2021 07:54:19 -0700 Subject: [PATCH 1/2] const inst = $instance_type($f) in macros --- src/KeywordCalls.jl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/KeywordCalls.jl b/src/KeywordCalls.jl index 1cfaedc..fca65ca 100644 --- a/src/KeywordCalls.jl +++ b/src/KeywordCalls.jl @@ -52,7 +52,9 @@ function _kwcall(__module__, ex) _sort = KeywordCalls._sort instance_type = KeywordCalls.instance_type q = quote - function KeywordCalls._call_in_default_order(::$instance_type($f), nt::NamedTuple{($(sorted_argnames...),)}) + const inst = $instance_type($f) + + function KeywordCalls._call_in_default_order(::inst, nt::NamedTuple{($(sorted_argnames...),)}) return $f_esc(NamedTuple{($(argnames...),)}(nt)) end end @@ -146,7 +148,13 @@ function _kwalias(f, aliasmap) @assert pair.head == :call @assert pair.args[1] == :(=>) (a,b) = QuoteNode.(pair.args[2:3]) - push!(q.args, :(KeywordCalls.alias(::$instance_type($f), ::Val{$a}) = $b)) + + newmethod = quote + const inst = $instance_type($f) + KeywordCalls.alias(::inst, ::Val{$a}) = $b + end + + push!(q.args, newmethod) end return q end From 498e16d21627c8aaa99f4f5c75a7b155d4108929 Mon Sep 17 00:00:00 2001 From: Chad Scherrer Date: Sat, 29 May 2021 08:00:59 -0700 Subject: [PATCH 2/2] version bump --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 33ce4dd..3003352 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "KeywordCalls" uuid = "4d827475-d3e4-43d6-abe3-9688362ede9f" authors = ["Chad Scherrer and contributors"] -version = "0.1.7" +version = "0.1.8" [deps] Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"