From 825b5d96f8a0d146615f0c6a76feab46da9baa60 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Mon, 22 Nov 2021 10:05:39 +0800 Subject: update macro spec and builtin Lua. --- spec/inputs/macro-todo.yue | 13 +++++++++++++ spec/inputs/macro.yue | 15 ++------------- 2 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 spec/inputs/macro-todo.yue (limited to 'spec/inputs') diff --git a/spec/inputs/macro-todo.yue b/spec/inputs/macro-todo.yue new file mode 100644 index 0000000..8477e5a --- /dev/null +++ b/spec/inputs/macro-todo.yue @@ -0,0 +1,13 @@ +export macro todoInner = (module, line, msg)-> + print "TODO#{msg and ': ' .. msg or ''} in file #{module}, at line #{line}" + { + code: "-- TODO#{msg and ': ' .. msg or ''}" + type: "lua" + } + +export macro todo = (msg)-> + if msg + "$todoInner $MODULE, $LINE, #{msg}" + else + "$todoInner $MODULE, $LINE" + diff --git a/spec/inputs/macro.yue b/spec/inputs/macro.yue index 366a3d9..2742bd0 100644 --- a/spec/inputs/macro.yue +++ b/spec/inputs/macro.yue @@ -6,6 +6,8 @@ import "macro-export" as { $config:$myconfig, -- rename macro $config to $myconfig } +import "macro-todo" as $ + $asserts item == nil $myconfig false @@ -258,19 +260,6 @@ print $tb[1], $tb.a, ($tb)!, $tb! print "current line: #{ $LINE }" -macro todoInner = (module, line, msg)-> - print "TODO#{msg and ': ' .. msg or ''} in file #{module}, at line #{line}" - { - code: "-- TODO#{msg and ': ' .. msg or ''}" - type: "lua" - } - -macro todo = (msg)-> - if msg - "$todoInner $MODULE, $LINE, #{msg}" - else - "$todoInner $MODULE, $LINE" - $todo macro implicitReturnMacroIsAllowed = -> "print 'abc'\n123" -- cgit v1.2.3-55-g6feb