From 06bf167924d04aaefe80d6e4ead40989a447ea34 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 17 May 2024 16:38:44 +0800 Subject: fix more cases in try-catch syntax. --- spec/outputs/unicode/try_catch.lua | 58 ++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 18 deletions(-) (limited to 'spec/outputs/unicode') diff --git a/spec/outputs/unicode/try_catch.lua b/spec/outputs/unicode/try_catch.lua index 7d95f9b..22f29f9 100644 --- a/spec/outputs/unicode/try_catch.lua +++ b/spec/outputs/unicode/try_catch.lua @@ -1,18 +1,26 @@ -xpcall(_u51fd_u6570, function(_u9519_u8bef) +xpcall(function() + return _u51fd_u6570(1, 2, 3) +end, function(_u9519_u8bef) return _u6253_u5370(_u9519_u8bef) -end, 1, 2, 3) -xpcall(_u51fd_u6570, function(_u9519_u8bef) +end) +xpcall(function() + return _u51fd_u6570(1, 2, 3) +end, function(_u9519_u8bef) return _u6253_u5370(_u9519_u8bef) -end, 1, 2, 3) +end) pcall(function() _u6253_u5370("正在try") return _u51fd_u6570(1, 2, 3) end) do - local _u6210_u529f, _u7ed3_u679c = xpcall(_u51fd_u6570, function(_u9519_u8bef) + local _u6210_u529f, _u7ed3_u679c = xpcall(function() + return _u51fd_u6570(1, 2, 3) + end, function(_u9519_u8bef) return _u6253_u5370(_u9519_u8bef) - end, 1, 2, 3) - _u6210_u529f, _u7ed3_u679c = pcall(_u51fd_u6570, 1, 2, 3) + end) + _u6210_u529f, _u7ed3_u679c = pcall(function() + return _u51fd_u6570(1, 2, 3) + end) end pcall(function() return _u8868["函数"] @@ -36,35 +44,49 @@ end) pcall(function() return _u8868["函数"](1) end) -if (xpcall(_u51fd_u6570, function(_u9519_u8bef) +if (xpcall(function() + return _u51fd_u6570(1) +end, function(_u9519_u8bef) return _u6253_u5370(_u9519_u8bef) -end, 1)) then +end)) then _u6253_u5370("好的") end -if xpcall((_u51fd_u6570), function(_u9519_u8bef) +if xpcall(function() + return _u51fd_u6570(1) +end, function(_u9519_u8bef) return _u6253_u5370(_u9519_u8bef) -end, 1) then +end) then _u6253_u5370("好的") end do do - local _u6210_u529f, _u7ed3_u679c = pcall(_u51fd_u6570, "abc", 123) + local _u6210_u529f, _u7ed3_u679c = pcall(function() + return _u51fd_u6570("abc", 123) + end) if _u6210_u529f then _u6253_u5370(_u7ed3_u679c) end end - local _u6210_u529f, _u7ed3_u679c = xpcall(_u51fd_u6570, function(_u9519_u8bef) + local _u6210_u529f, _u7ed3_u679c = xpcall(function() + return _u51fd_u6570("abc", 123) + end, function(_u9519_u8bef) return _u6253_u5370(_u9519_u8bef) - end, "abc", 123) - _u6210_u529f, _u7ed3_u679c = xpcall(_u51fd_u6570, function(_u9519_u8bef) + end) + _u6210_u529f, _u7ed3_u679c = xpcall(function() + return _u51fd_u6570("abc", 123) + end, function(_u9519_u8bef) return _u6253_u5370(_u9519_u8bef) - end, "abc", 123) + end) if _u6210_u529f then _u6253_u5370(_u7ed3_u679c) end end do - pcall(_u51fd_u6570, 1, 2, 3) - pcall(_u51fd_u6570, 1, 2, 3) + pcall(function() + return _u51fd_u6570(1, 2, 3) + end) + pcall(function() + return _u51fd_u6570(1, 2, 3) + end) end return nil -- cgit v1.2.3-55-g6feb