From 2a7256ea8cb8a292d8f395c13ed2462df4c084a0 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 15 Oct 2020 09:38:01 +0800 Subject: add support to import all macros from a module with symbol '$' in import-as statement. fix import macro rename issue. --- spec/inputs/macro.mp | 5 ++++- spec/inputs/macro_export.mp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'spec') diff --git a/spec/inputs/macro.mp b/spec/inputs/macro.mp index c7ec79c..103df95 100644 --- a/spec/inputs/macro.mp +++ b/spec/inputs/macro.mp @@ -5,7 +5,10 @@ macro block init = -> $init! -import "macro_export" as {$myconfig:$config, :$showMacro, :$asserts, :$assert} +import "macro_export" as { + $, -- import all macros + $config:$myconfig, -- rename macro $config to $myconfig +} $asserts item == nil diff --git a/spec/inputs/macro_export.mp b/spec/inputs/macro_export.mp index 759c6d1..7208b2a 100644 --- a/spec/inputs/macro_export.mp +++ b/spec/inputs/macro_export.mp @@ -11,7 +11,7 @@ export macro expr showMacro = (name,res)-> print txt txt" else - "#{res}" + res export macro block asserts = (cond)-> if debugMode -- cgit v1.2.3-55-g6feb