richardhundt / shine

A Shiny Lua Dialect
Other
231 stars 18 forks source link

Fix bytecode generator to emit implicit return statement #23

Closed franko closed 11 years ago

franko commented 11 years ago

Hi Richard,

now I beginning to understand the bytecode generator and it seems that I was even able to fix a bug. The Nyanga bytecode generator does not emit the instruction for the implicit return when required.

For example the following code raise an error:

i = 0
n = 10
function count()
    if i < n then
        i = i + 1
        return i
    end
end

for k in count do
    print(k)
end

I propose a simple fix for this problem.

Francesco

franko commented 11 years ago

Please wait to validate or refuse the request. I've found that the fix need some more works. I will issue another pull request.