Skip to content

Commit 0a910dc

Browse files
bug fix
1 parent 98d2604 commit 0a910dc

1 file changed

Lines changed: 22 additions & 8 deletions

File tree

cps2.pp.lua

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
{head='while',body='WHILE'},
3939
{head='break',body='BREAK'},
4040
{head='continue',body='continue'},
41-
{head='call ?cfun (?,values) ??,rest @end',
42-
body ='?cfun(function() ?rest end,?values)' },
43-
{head='call ?cfun () ??,rest @end',
44-
body ='?cfun(function() ?rest end)' },
4541
{head='call ?,v = ?cfun (?,values) ??,rest @end',
4642
body ='?cfun(function(...) ?v=...; ?rest end,?values)' },
4743
{head='call ?,v = ?cfun () ??,rest @end',
4844
body ='?cfun(function(...) ?v=...; ?rest end)' },
45+
{head='call ?cfun (?,values) ??,rest @end',
46+
body ='?cfun(function() ?rest end,?values)' },
47+
{head='call ?cfun () ??,rest @end',
48+
body ='?cfun(function() ?rest end)' },
4949
{head ='store_and_ret_cc(?dest) ??,rest @end',
5050
body=[[
5151
local %temp = funcc() ?rest end
@@ -70,14 +70,14 @@
7070
{head='while',body='WHILE'},
7171
{head='break',body='BREAK'},
7272
{head='continue',body='continue'},
73-
{head='call ?cfun (?,values) ??,rest @end',
74-
body ='?cfun(function() ?rest end,?values)' },
75-
{head='call ?cfun () ??,rest @end',
76-
body ='?cfun(function() ?rest end)' },
7773
{head='call ?,v = ?cfun (?,values) ??,rest @end',
7874
body ='?cfun(function(...) ?v=...; ?rest end,?values)' },
7975
{head='call ?,v = ?cfun () ??,rest @end',
8076
body ='?cfun(function(...) ?v=...; ?rest end)' },
77+
{head='call ?cfun (?,values) ??,rest @end',
78+
body ='?cfun(function() ?rest end,?values)' },
79+
{head='call ?cfun () ??,rest @end',
80+
body ='?cfun(function() ?rest end)' },
8181
{head ='store_and_ret_cc(?dest) ??,rest @end',
8282
body=[[
8383
local %temp = funcc() ?rest end
@@ -113,6 +113,7 @@ count3 = funcc(store)
113113
n=3
114114
retc(n)
115115
end
116+
116117

117118
local cont={}
118119
local m
@@ -126,7 +127,20 @@ count3 = funcc(store)
126127
endcc
127128
endcc
128129

130+
funcc_count3 = funcc(cont)
131+
local m
132+
call m=count3(cont)
133+
print(m)
134+
call m=cont[1](cont)
135+
print(m)
136+
call m=cont[1](cont)
137+
print(m)
138+
retc()
139+
end
129140

141+
callcc funcc_count3(cont)
142+
endcc
143+
130144
--oops, no continuation allowed in the test!
131145
@macro {
132146
head='WHILE ?exp DO ??,statements END',

0 commit comments

Comments
 (0)