viruscamp / luadec

Lua Decompiler for lua 5.1 , 5.2 and 5.3
1.14k stars 343 forks source link

direct call function output error #13

Closed viruscamp closed 10 years ago

viruscamp commented 10 years ago
(
function()
    print("abc")
end
)()
;-- must output this
(
function(a)
    print(type(a))
end
)(function()
    print("abe")
end)
;
local a = (function() print(1) end)+1

((function() print(1) end)+(function() print(2) end))()
;
(1+(function() print(1) end)+2)()
viruscamp commented 10 years ago

;-- must output this semicolon inserting not implemented

local b=f
((function() print(1) end)+(function() print(2) end))()

We should insert a ';' , when next statement start with '(' . Should be processed in ast.c : PrintAstStatement .

viruscamp commented 10 years ago

test cases: luadec issue13_direct_call.lua > i13.lua luadec i13.lua

luadec issue4_jmp_loadbool.lua main.lua > i4+m.lua luadec i4+m.lua

viruscamp commented 10 years ago

e4f956c import a new bug ,when using OP_SELF a:f() decompied to (a:f)()