aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-07-05 11:25:59 +0800
committerLi Jin <dragon-fly@qq.com>2022-07-05 11:25:59 +0800
commit3106afc2473ce12787e1fcae2e2c3a101214045d (patch)
treed85296ea11e389fcd989ed5a4d3a71add73dde02 /spec
parentce9338c540ac3397f3d15c442033a618d12c5105 (diff)
downloadyuescript-3106afc2473ce12787e1fcae2e2c3a101214045d.tar.gz
yuescript-3106afc2473ce12787e1fcae2e2c3a101214045d.tar.bz2
yuescript-3106afc2473ce12787e1fcae2e2c3a101214045d.zip
disable exporting macro from a normal module.
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/macro-export.yue25
-rw-r--r--spec/inputs/macro.yue2
-rw-r--r--spec/outputs/macro-export.lua2
-rw-r--r--spec/outputs/macro-teal.tl2
-rw-r--r--spec/outputs/macro-todo.lua2
5 files changed, 18 insertions, 15 deletions
diff --git a/spec/inputs/macro-export.yue b/spec/inputs/macro-export.yue
index d669975..22ef424 100644
--- a/spec/inputs/macro-export.yue
+++ b/spec/inputs/macro-export.yue
@@ -1,15 +1,22 @@
1$ -> package.path = "?.lua;./spec/inputs/?.lua"
2
3import "macro-todo" as $
4
5import "macro-todo" as {$, :$todo}
6
1export macro config = (debugging = true)-> 7export macro config = (debugging = true)->
2 global debugMode = debugging == "true" 8 global debugMode = debugging == "true"
3 global debugMacro = true 9 global debugMacro = true
4 "" 10 ""
5 11
6export macro showMacro = (name,res)-> 12export macro showMacro = (name, res)->
7 if debugMacro 13 if debugMacro then "
8 "do 14do
9 txt = #{res} 15 txt = #{res}
10 print '[macro '..#{name}..']' 16 print '[macro ' .. #{name} .. ']'
11 print txt 17 print txt
12 txt" 18 txt
19"
13 else 20 else
14 res 21 res
15 22
@@ -25,5 +32,7 @@ export macro assert = (cond)->
25 else 32 else
26 "#{cond}" 33 "#{cond}"
27 34
28$config! 35$ ->
36 global debugMode = true
37 global debugMacro = true
29 38
diff --git a/spec/inputs/macro.yue b/spec/inputs/macro.yue
index 37702d1..e391b9e 100644
--- a/spec/inputs/macro.yue
+++ b/spec/inputs/macro.yue
@@ -3,7 +3,7 @@ $ ->
3 3
4import "macro-export" as { 4import "macro-export" as {
5 $, -- import all macros 5 $, -- import all macros
6 $config:$myconfig, -- rename macro $config to $myconfig 6 $config: $myconfig, -- rename macro $config to $myconfig
7} 7}
8 8
9import "macro-todo" as $ 9import "macro-todo" as $
diff --git a/spec/outputs/macro-export.lua b/spec/outputs/macro-export.lua
deleted file mode 100644
index b5a63f8..0000000
--- a/spec/outputs/macro-export.lua
+++ /dev/null
@@ -1,2 +0,0 @@
1local _module_0 = { }
2return _module_0
diff --git a/spec/outputs/macro-teal.tl b/spec/outputs/macro-teal.tl
deleted file mode 100644
index b5a63f8..0000000
--- a/spec/outputs/macro-teal.tl
+++ /dev/null
@@ -1,2 +0,0 @@
1local _module_0 = { }
2return _module_0
diff --git a/spec/outputs/macro-todo.lua b/spec/outputs/macro-todo.lua
deleted file mode 100644
index b5a63f8..0000000
--- a/spec/outputs/macro-todo.lua
+++ /dev/null
@@ -1,2 +0,0 @@
1local _module_0 = { }
2return _module_0