summaryrefslogtreecommitdiff
path: root/testes/coroutine.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-07-30 12:18:19 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-07-30 12:18:19 -0300
commit0d529138042563baf260366e19a7aa2c60a07174 (patch)
treeea8699a57a9b26e620a2ed6bc2a11c9e49dee780 /testes/coroutine.lua
parentb80077b8f3e27a94c6afa895b41a9f8b52c42e61 (diff)
downloadlua-0d529138042563baf260366e19a7aa2c60a07174.tar.gz
lua-0d529138042563baf260366e19a7aa2c60a07174.tar.bz2
lua-0d529138042563baf260366e19a7aa2c60a07174.zip
Change in the syntax of attributes
Attributes changed to posfixed ('x <const>', instead of '<const> x'), and "toclose" renamed to "close". Posfixed attributes seem to make it clearer that it applies to only one variable when there are multiple variables.
Diffstat (limited to 'testes/coroutine.lua')
-rw-r--r--testes/coroutine.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/testes/coroutine.lua b/testes/coroutine.lua
index 00531d8e..457374ca 100644
--- a/testes/coroutine.lua
+++ b/testes/coroutine.lua
@@ -151,7 +151,7 @@ do
151 end 151 end
152 152
153 co = coroutine.create(function () 153 co = coroutine.create(function ()
154 local <toclose> x = func2close(function (self, err) 154 local x <close> = func2close(function (self, err)
155 assert(err == nil); X = false 155 assert(err == nil); X = false
156 end) 156 end)
157 X = true 157 X = true
@@ -165,12 +165,12 @@ do
165 -- error closing a coroutine 165 -- error closing a coroutine
166 local x = 0 166 local x = 0
167 co = coroutine.create(function() 167 co = coroutine.create(function()
168 local <toclose> y = func2close(function (self,err) 168 local y <close> = func2close(function (self,err)
169 if (err ~= 111) then os.exit(false) end -- should not happen 169 if (err ~= 111) then os.exit(false) end -- should not happen
170 x = 200 170 x = 200
171 error(200) 171 error(200)
172 end) 172 end)
173 local <toclose> x = func2close(function (self, err) 173 local x <close> = func2close(function (self, err)
174 assert(err == nil); error(111) 174 assert(err == nil); error(111)
175 end) 175 end)
176 coroutine.yield() 176 coroutine.yield()
@@ -356,7 +356,7 @@ do
356 356
357 local X = false 357 local X = false
358 A = coroutine.wrap(function() 358 A = coroutine.wrap(function()
359 local <toclose> _ = setmetatable({}, {__close = function () X = true end}) 359 local _ <close> = setmetatable({}, {__close = function () X = true end})
360 return pcall(A, 1) 360 return pcall(A, 1)
361 end) 361 end)
362 st, res = A() 362 st, res = A()