Skip to content

Commit

Permalink
Corrected nil value
Browse files Browse the repository at this point in the history
  • Loading branch information
jefersonla committed Nov 16, 2016
1 parent 84c9a0c commit 1bc8615
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
4 changes: 2 additions & 2 deletions codegen_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#define GLOBAL_VARIABLE_PREFIX "__"

/* Value of a nil variable */
#define NIL_TYPE_MASK "0x7FFFFFFF"
#define NIL_TYPE_VALUE "0x80000000"
#define NIL_TYPE_MASK "0x7FFFFFFD"
#define NIL_TYPE_VALUE "0x80000002"

/* Logical type */
#define VOID_TYPE 0
Expand Down
45 changes: 45 additions & 0 deletions test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
function fibo(n)
if n <= 1 then
return 1
else
return fibo(n - 1) + fibo(n - 2)
end
end

function teste(n)
if n / 2 * 2 == n then
return fibo(n), fibo(n / 2), fibo(n / 3) + fibo(n / 4)
else
return fibo(n), fibo(n + 1)
end
end

n = 1
while n <= 20 do
if n / 2 * 2 == n then
x, y, z = teste(n)
print(x)
print(y)
print(z)
else
x, y = teste(n)
print(x)
print(y)
end
n = n + 1
end
--for n = 1, 20 do
-- print(n)
-- print(1111111111)
-- if n / 2 * 2 == n then
-- x, y, z = teste(n)
-- print(x)
-- print(y)
-- print(z)
-- else
-- x, y = teste(n)
-- print(x)
-- print(y)
-- end
--end

2 changes: 0 additions & 2 deletions tests/input/input-41
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ function fibo(n)

end


function teste(n)
if n / 2 * 2 == n then
return fibo(n), fibo(n / 2), fibo(n / 3) + fibo(n / 4)
Expand All @@ -16,7 +15,6 @@ function teste(n)
end
end


for n = 1, 20 do
if n / 2 * 2 == n then
x, y, z = teste(n)
Expand Down

0 comments on commit 1bc8615

Please sign in to comment.