aboutsummaryrefslogtreecommitdiff
path: root/testes/code.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/code.lua')
-rw-r--r--testes/code.lua36
1 files changed, 18 insertions, 18 deletions
diff --git a/testes/code.lua b/testes/code.lua
index 57923b14..3b768f33 100644
--- a/testes/code.lua
+++ b/testes/code.lua
@@ -8,22 +8,22 @@ end
8print "testing code generation and optimizations" 8print "testing code generation and optimizations"
9 9
10-- to test constant propagation 10-- to test constant propagation
11local <const> k0aux = 0 11local k0aux <const> = 0
12local <const> k0 = k0aux 12local k0 <const> = k0aux
13local <const> k1 = 1 13local k1 <const> = 1
14local <const> k3 = 3 14local k3 <const> = 3
15local <const> k6 = k3 + (k3 << k0) 15local k6 <const> = k3 + (k3 << k0)
16local <const> kFF0 = 0xFF0 16local kFF0 <const> = 0xFF0
17local <const> k3_78 = 3.78 17local k3_78 <const> = 3.78
18local <const> x, <const> k3_78_4 = 10, k3_78 / 4 18local x, k3_78_4 <const> = 10, k3_78 / 4
19assert(x == 10) 19assert(x == 10)
20 20
21local <const> kx = "x" 21local kx <const> = "x"
22 22
23local <const> kTrue = true 23local kTrue <const> = true
24local <const> kFalse = false 24local kFalse <const> = false
25 25
26local <const> kNil = nil 26local kNil <const> = nil
27 27
28-- this code gave an error for the code checker 28-- this code gave an error for the code checker
29do 29do
@@ -105,7 +105,7 @@ end, 'CLOSURE', 'NEWTABLE', 'EXTRAARG', 'GETTABUP', 'CALL',
105 105
106-- sequence of LOADNILs 106-- sequence of LOADNILs
107check(function () 107check(function ()
108 local <const> kNil = nil 108 local kNil <const> = nil
109 local a,b,c 109 local a,b,c
110 local d; local e; 110 local d; local e;
111 local f,g,h; 111 local f,g,h;
@@ -173,7 +173,7 @@ end,
173 173
174-- "get/set table" with numeric indices 174-- "get/set table" with numeric indices
175check(function (a) 175check(function (a)
176 local <const> k255 = 255 176 local k255 <const> = 255
177 a[1] = a[100] 177 a[1] = a[100]
178 a[k255] = a[256] 178 a[k255] = a[256]
179 a[256] = 5 179 a[256] = 5
@@ -276,14 +276,14 @@ checkI(function () return ((100 << k6) << -4) >> 2 end, 100)
276 276
277-- borders around MAXARG_sBx ((((1 << 17) - 1) >> 1) == 65535) 277-- borders around MAXARG_sBx ((((1 << 17) - 1) >> 1) == 65535)
278local a = 17; local sbx = ((1 << a) - 1) >> 1 -- avoid folding 278local a = 17; local sbx = ((1 << a) - 1) >> 1 -- avoid folding
279local <const> border = 65535 279local border <const> = 65535
280checkI(function () return border end, sbx) 280checkI(function () return border end, sbx)
281checkI(function () return -border end, -sbx) 281checkI(function () return -border end, -sbx)
282checkI(function () return border + 1 end, sbx + 1) 282checkI(function () return border + 1 end, sbx + 1)
283checkK(function () return border + 2 end, sbx + 2) 283checkK(function () return border + 2 end, sbx + 2)
284checkK(function () return -(border + 1) end, -(sbx + 1)) 284checkK(function () return -(border + 1) end, -(sbx + 1))
285 285
286local <const> border = 65535.0 286local border <const> = 65535.0
287checkF(function () return border end, sbx + 0.0) 287checkF(function () return border end, sbx + 0.0)
288checkF(function () return -border end, -sbx + 0.0) 288checkF(function () return -border end, -sbx + 0.0)
289checkF(function () return border + 1 end, (sbx + 1.0)) 289checkF(function () return border + 1 end, (sbx + 1.0))
@@ -411,9 +411,9 @@ checkequal(function () return 6 and true or nil end,
411 411
412 412
413do -- string constants 413do -- string constants
414 local <const> k0 = "00000000000000000000000000000000000000000000000000" 414 local k0 <const> = "00000000000000000000000000000000000000000000000000"
415 local function f1 () 415 local function f1 ()
416 local <const> k = k0 416 local k <const> = k0
417 return function () 417 return function ()
418 return function () return k end 418 return function () return k end
419 end 419 end