From ddd9d7545eeac259dcaf06c08be286b3667addfd Mon Sep 17 00:00:00 2001 From: Juha Jeronen Date: Sat, 6 Oct 2018 01:16:50 +0300 Subject: [PATCH] support named arguments, sensibly --- macropy/core/macros.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/macropy/core/macros.py b/macropy/core/macros.py index b9c5ef5..c2c29b1 100644 --- a/macropy/core/macros.py +++ b/macropy/core/macros.py @@ -108,18 +108,16 @@ def get_macro_details(self, macro_tree): - the tree containing the macro itself (it is *macro_tree* itself as of now); - arguments to the macro invocation; - - if a Call, named arguments to the macro invocation, as OrderedDict. + - named arguments to the macro invocation. """ - kwargs = collections.OrderedDict() # keywords is a list; preserve order if isinstance(macro_tree, ast.Call): call_args = tuple(macro_tree.args) - for kw in macro_tree.keywords: - if kw.arg is not None: - kwargs[kw.arg] = kw.value + kwargs = tuple(macro_tree.keywords) macro_tree = macro_tree.func else: call_args = () + kwargs = () if isinstance(macro_tree, ast.Name): return macro_tree.id, macro_tree, call_args, kwargs else: