From f7269a635e31e075c45ec9d10e4c1df5cf9f8a33 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 29 Aug 2025 10:55:21 +0800 Subject: Fixed build. --- spec/outputs/codes_from_doc.lua | 90 ++++++++++++++++++++++++++++++++++++++ spec/outputs/codes_from_doc_zh.lua | 90 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+) (limited to 'spec') diff --git a/spec/outputs/codes_from_doc.lua b/spec/outputs/codes_from_doc.lua index b7d1236..055e79b 100644 --- a/spec/outputs/codes_from_doc.lua +++ b/spec/outputs/codes_from_doc.lua @@ -923,6 +923,36 @@ if func(1, 2, 3, "hello", "world") then print("hello") print("I am inside if") end +local f1 +f1 = function(_arg_0) + local a, b, c + a, b, c = _arg_0.a, _arg_0.b, _arg_0.c + return print(a, b, c) +end +f1({ + a = 1, + b = "2", + c = { } +}) +local f2 +f2 = function(_arg_0, c) + local a1, b + a1, b = _arg_0.a, _arg_0.b + if a1 == nil then + a1 = 123 + end + if b == nil then + b = 'abc' + end + if c == nil then + c = { } + end + return print(a1, b, c) +end +local arg1 = { + a = 0 +} +f2(arg1, arg2) f(function() return print("hello") end) @@ -3332,6 +3362,66 @@ if func(1, 2, 3, "hello", "world") then print("hello") print("I am inside if") end +local f1 +f1 = function(_arg_0) + local a, b, c + a, b, c = _arg_0.a, _arg_0.b, _arg_0.c + return print(a, b, c) +end +f1({ + a = 1, + b = "2", + c = { } +}) +local f2 +f2 = function(_arg_0, c) + local a1, b + a1, b = _arg_0.a, _arg_0.b + if a1 == nil then + a1 = 123 + end + if b == nil then + b = 'abc' + end + if c == nil then + c = { } + end +end +print(a1, b, c) +local arg1 = { + a = 0 +} +f2(arg1, arg2) +local findFirstEven +findFirstEven = function(list) + for _index_0 = 1, #list do + local item = list[_index_0] + if type(item) == "table" then + for _index_1 = 1, #item do + local sub = item[_index_1] + if sub % 2 == 0 then + return sub + end + end + end + end + return nil +end +local findFirstEven +findFirstEven = function(list) + for _index_0 = 1, #list do + local item = list[_index_0] + if type(item) == "table" then + for _index_1 = 1, #item do + local sub = item[_index_1] + if sub % 2 == 0 then + return sub + end + end + end + end + return nil +end f(function() return print("hello") end) diff --git a/spec/outputs/codes_from_doc_zh.lua b/spec/outputs/codes_from_doc_zh.lua index b54d6d7..de76829 100644 --- a/spec/outputs/codes_from_doc_zh.lua +++ b/spec/outputs/codes_from_doc_zh.lua @@ -917,6 +917,36 @@ if func(1, 2, 3, "你好", "世界") then print("hello") print("我在if内部") end +local f1 +f1 = function(_arg_0) + local a, b, c + a, b, c = _arg_0.a, _arg_0.b, _arg_0.c + return print(a, b, c) +end +f1({ + a = 1, + b = "2", + c = { } +}) +local f2 +f2 = function(_arg_0, c) + local a1, b + a1, b = _arg_0.a, _arg_0.b + if a1 == nil then + a1 = 123 + end + if b == nil then + b = 'abc' + end + if c == nil then + c = { } + end + return print(a1, b, c) +end +local arg1 = { + a = 0 +} +f2(arg1, arg2) f(function() return print("hello") end) @@ -3320,6 +3350,66 @@ if func(1, 2, 3, "你好", "世界") then print("你好") print("我在if内部") end +local f1 +f1 = function(_arg_0) + local a, b, c + a, b, c = _arg_0.a, _arg_0.b, _arg_0.c + return print(a, b, c) +end +f1({ + a = 1, + b = "2", + c = { } +}) +local f2 +f2 = function(_arg_0, c) + local a1, b + a1, b = _arg_0.a, _arg_0.b + if a1 == nil then + a1 = 123 + end + if b == nil then + b = 'abc' + end + if c == nil then + c = { } + end + return print(a1, b, c) +end +local arg1 = { + a = 0 +} +f2(arg1, arg2) +local findFirstEven +findFirstEven = function(list) + for _index_0 = 1, #list do + local item = list[_index_0] + if type(item) == "table" then + for _index_1 = 1, #item do + local sub = item[_index_1] + if sub % 2 == 0 then + return sub + end + end + end + end + return nil +end +local findFirstEven +findFirstEven = function(list) + for _index_0 = 1, #list do + local item = list[_index_0] + if type(item) == "table" then + for _index_1 = 1, #item do + local sub = item[_index_1] + if sub % 2 == 0 then + return sub + end + end + end + end + return nil +end f(function() return print("hello") end) -- cgit v1.2.3-55-g6feb