diff options
author | Li Jin <dragon-fly@qq.com> | 2025-01-31 01:02:59 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2025-01-31 01:02:59 +0800 |
commit | f5c1735262f07f8064575bebec8b593559abe619 (patch) | |
tree | c0e3d660e647843c37df451e4028ec5590edb8e2 /spec | |
parent | cf91f61990babdd8a80774809e9e860a155e4201 (diff) | |
download | yuescript-f5c1735262f07f8064575bebec8b593559abe619.tar.gz yuescript-f5c1735262f07f8064575bebec8b593559abe619.tar.bz2 yuescript-f5c1735262f07f8064575bebec8b593559abe619.zip |
Fixing issue #178.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/inputs/macro.yue | 9 | ||||
-rw-r--r-- | spec/outputs/macro.lua | 11 |
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 | ||
343 | do | ||
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 | |||
343 | macro implicitReturnMacroIsAllowed = -> "print 'abc'\n123" | 352 | macro 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 |
331 | end | 331 | end |
332 | do | 332 | do |
333 | f = function() | ||
334 | x = (tb:func(123)):bar(456) | ||
335 | return (tb:func(123)) | ||
336 | end | ||
337 | local f1 | ||
338 | f1 = function() | ||
339 | tb:func(123) | ||
340 | return | ||
341 | end | ||
342 | end | ||
343 | do | ||
333 | print('abc') | 344 | print('abc') |
334 | return 123 | 345 | return 123 |
335 | end | 346 | end |