From 604a8e5e53cdc7391a502fcabf07e8f1cc2a778c Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 21 Jan 2026 10:05:19 +0800 Subject: Update. --- spec/outputs/5.1/import_global.lua | 42 +++++++++++++++++++++++++++++++++++++- spec/outputs/import_global.lua | 42 +++++++++++++++++++++++++++++++++++++- spec/outputs/test/format_spec.lua | 1 + 3 files changed, 83 insertions(+), 2 deletions(-) (limited to 'spec/outputs') diff --git a/spec/outputs/5.1/import_global.lua b/spec/outputs/5.1/import_global.lua index 3b8334a..b5ac582 100644 --- a/spec/outputs/5.1/import_global.lua +++ b/spec/outputs/5.1/import_global.lua @@ -41,8 +41,8 @@ do func(1, 2) end do - local xpcall = xpcall local func = func + local xpcall = xpcall local world = world local tostring = tostring local print = print @@ -129,3 +129,43 @@ do return pcall(_anon_func_0, func) end end +do + local func = func + local pcall = pcall + local print = print + local Item = Item + local f + f = function() + local result + local _ok_0, _ret_0 = pcall(func) + if _ok_0 then + result = _ret_0 + end + if result then + return print(result) + end + end + if 1 == Item then + print("one") + elseif 2 == Item then + print("two") + end +end +local b = b +local a = a +local c = c +local print = print +local _anon_func_1 = function() + local _cond_0 = b() + if not (a() < _cond_0) then + return false + else + return _cond_0 < c() + end +end +local f +f = function() + if _anon_func_1() then + return print("OK") + end +end diff --git a/spec/outputs/import_global.lua b/spec/outputs/import_global.lua index 895daf9..2d6c61b 100644 --- a/spec/outputs/import_global.lua +++ b/spec/outputs/import_global.lua @@ -41,8 +41,8 @@ do func(1, 2) end do - local xpcall = xpcall local func = func + local xpcall = xpcall local world = world local tostring = tostring local print = print @@ -129,3 +129,43 @@ do return pcall(_anon_func_0, func) end end +do + local func = func + local pcall = pcall + local print = print + local Item = Item + local f + f = function() + local result + local _ok_0, _ret_0 = pcall(func) + if _ok_0 then + result = _ret_0 + end + if result then + return print(result) + end + end + if 1 == Item then + print("one") + elseif 2 == Item then + print("two") + end +end +local b = b +local a = a +local c = c +local print = print +local _anon_func_1 = function() + local _cond_0 = b() + if not (a() < _cond_0) then + return false + else + return _cond_0 < c() + end +end +local f +f = function() + if _anon_func_1() then + return print("OK") + end +end diff --git a/spec/outputs/test/format_spec.lua b/spec/outputs/test/format_spec.lua index 7aa85cd..898fa03 100644 --- a/spec/outputs/test/format_spec.lua +++ b/spec/outputs/test/format_spec.lua @@ -51,6 +51,7 @@ local files = { "spec/inputs/test/loops_spec.yue", "spec/inputs/test/format_spec.yue", "spec/inputs/upvalue_func.yue", + "spec/inputs/import_global.yue", "spec/inputs/unicode/macro_export.yue", "spec/inputs/unicode/attrib.yue", "spec/inputs/unicode/macro.yue", -- cgit v1.2.3-55-g6feb