From 5604bbbb80bfcedb4a9085b90864e221f8104b33 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 28 May 2025 18:20:16 +0800 Subject: Added `try!` syntax. --- spec/outputs/codes_from_doc.lua | 100 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) (limited to 'spec/outputs/codes_from_doc.lua') diff --git a/spec/outputs/codes_from_doc.lua b/spec/outputs/codes_from_doc.lua index 55be7df..cce0516 100644 --- a/spec/outputs/codes_from_doc.lua +++ b/spec/outputs/codes_from_doc.lua @@ -688,6 +688,56 @@ end) if success then print(result) end +local a, b, c +do + local _ok_0, _ret_0, _ret_1, _ret_2 = pcall(function() + return func() + end) + if _ok_0 then + a, b, c = _ret_0, _ret_1, _ret_2 + end +end +do + local _exp_0 = ((function() + return (function(_arg_0, ...) + local _ok_0 = _arg_0 + if _ok_0 then + return ... + end + end)(pcall(function() + return func() + end)) + end)()) + if _exp_0 ~= nil then + a = _exp_0 + else + a = "default" + end +end +f((function() + return (function(_arg_0, ...) + local _ok_0 = _arg_0 + if _ok_0 then + return ... + end + end)(pcall(function() + return func() + end)) +end)()) +f((function() + return (function(_arg_0, ...) + local _ok_0 = _arg_0 + if _ok_0 then + return ... + end + end)(xpcall(function() + print(123) + return func() + end, function(e) + print(e) + return e + end)) +end)()) local a = 123 local _ = setmetatable({ }, { __close = function() @@ -2909,6 +2959,56 @@ end) if success then print(result) end +local a, b, c +do + local _ok_0, _ret_0, _ret_1, _ret_2 = pcall(function() + return func() + end) + if _ok_0 then + a, b, c = _ret_0, _ret_1, _ret_2 + end +end +do + local _exp_0 = ((function() + return (function(_arg_0, ...) + local _ok_0 = _arg_0 + if _ok_0 then + return ... + end + end)(pcall(function() + return func() + end)) + end)()) + if _exp_0 ~= nil then + a = _exp_0 + else + a = "default" + end +end +f((function() + return (function(_arg_0, ...) + local _ok_0 = _arg_0 + if _ok_0 then + return ... + end + end)(pcall(function() + return func() + end)) +end)()) +f((function() + return (function(_arg_0, ...) + local _ok_0 = _arg_0 + if _ok_0 then + return ... + end + end)(xpcall(function() + print(123) + return func() + end, function(e) + print(e) + return e + end)) +end)()) local a = 123 local _ = setmetatable({ }, { __close = function() -- cgit v1.2.3-55-g6feb