aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2025-01-31 01:02:59 +0800
committerLi Jin <dragon-fly@qq.com>2025-01-31 01:02:59 +0800
commitf5c1735262f07f8064575bebec8b593559abe619 (patch)
treec0e3d660e647843c37df451e4028ec5590edb8e2 /spec
parentcf91f61990babdd8a80774809e9e860a155e4201 (diff)
downloadyuescript-f5c1735262f07f8064575bebec8b593559abe619.tar.gz
yuescript-f5c1735262f07f8064575bebec8b593559abe619.tar.bz2
yuescript-f5c1735262f07f8064575bebec8b593559abe619.zip
Fixing issue #178.
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/macro.yue9
-rw-r--r--spec/outputs/macro.lua11
2 files changed, 20 insertions, 0 deletions
diff --git a/spec/inputs/macro.yue b/spec/inputs/macro.yue
index 5dafd84..5d5f1a9 100644
--- a/spec/inputs/macro.yue
+++ b/spec/inputs/macro.yue
@@ -340,6 +340,15 @@ _1 = ->
340 print 2 340 print 2
341 print 3 341 print 3
342 342
343do
344 macro foo = -> code: "tb:func(123)", type: "lua"
345 f = ->
346 x = $foo\bar 456
347 $foo!
348 f1 = ->
349 $foo!
350 return
351
343macro implicitReturnMacroIsAllowed = -> "print 'abc'\n123" 352macro implicitReturnMacroIsAllowed = -> "print 'abc'\n123"
344 353
345$implicitReturnMacroIsAllowed 354$implicitReturnMacroIsAllowed
diff --git a/spec/outputs/macro.lua b/spec/outputs/macro.lua
index 83c6a90..7163077 100644
--- a/spec/outputs/macro.lua
+++ b/spec/outputs/macro.lua
@@ -330,6 +330,17 @@ _1 = function()
330 return _accum_0 330 return _accum_0
331end 331end
332do 332do
333 f = function()
334 x = (tb:func(123)):bar(456)
335 return (tb:func(123))
336 end
337 local f1
338 f1 = function()
339tb:func(123)
340 return
341 end
342end
343do
333 print('abc') 344 print('abc')
334 return 123 345 return 123
335end 346end