aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-10-15 09:38:01 +0800
committerLi Jin <dragon-fly@qq.com>2020-10-15 09:38:01 +0800
commit2a7256ea8cb8a292d8f395c13ed2462df4c084a0 (patch)
tree03600fe01a7b4fd6c49f80eb1e570503bdc5bee4 /spec
parentb4687f90305c24149a5d43d84bf64fa192dae8f8 (diff)
downloadyuescript-2a7256ea8cb8a292d8f395c13ed2462df4c084a0.tar.gz
yuescript-2a7256ea8cb8a292d8f395c13ed2462df4c084a0.tar.bz2
yuescript-2a7256ea8cb8a292d8f395c13ed2462df4c084a0.zip
add support to import all macros from a module with symbol '$' in import-as statement.
fix import macro rename issue.
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/macro.mp5
-rw-r--r--spec/inputs/macro_export.mp2
2 files changed, 5 insertions, 2 deletions
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 = ->
5 5
6$init! 6$init!
7 7
8import "macro_export" as {$myconfig:$config, :$showMacro, :$asserts, :$assert} 8import "macro_export" as {
9 $, -- import all macros
10 $config:$myconfig, -- rename macro $config to $myconfig
11}
9 12
10$asserts item == nil 13$asserts item == nil
11 14
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)->
11 print txt 11 print txt
12 txt" 12 txt"
13 else 13 else
14 "#{res}" 14 res
15 15
16export macro block asserts = (cond)-> 16export macro block asserts = (cond)->
17 if debugMode 17 if debugMode