diff options
| author | Roberto I <roberto@inf.puc-rio.br> | 2025-09-24 18:33:08 -0300 |
|---|---|---|
| committer | Roberto I <roberto@inf.puc-rio.br> | 2025-09-24 18:33:08 -0300 |
| commit | 25c54fe60e22d05cdfaa48c64372d354efa59547 (patch) | |
| tree | 3ccaeded5e4363db358f73b7c8fc6b9f414a2f2a /testes/locals.lua | |
| parent | 0cc3c9447cca9abae9738ee77c24d88801c3916c (diff) | |
| download | lua-25c54fe60e22d05cdfaa48c64372d354efa59547.tar.gz lua-25c54fe60e22d05cdfaa48c64372d354efa59547.tar.bz2 lua-25c54fe60e22d05cdfaa48c64372d354efa59547.zip | |
Optimization for vararg tables
A vararg table can be virtual. If the vararg table is used only as
a base in indexing expressions, the code does not need to create an
actual table for it. Instead, it compiles the indexing expressions
into direct accesses to the internal vararg data.
Diffstat (limited to 'testes/locals.lua')
| -rw-r--r-- | testes/locals.lua | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/testes/locals.lua b/testes/locals.lua index 02f41980..5222802f 100644 --- a/testes/locals.lua +++ b/testes/locals.lua | |||
| @@ -310,8 +310,7 @@ do -- testing presence of second argument | |||
| 310 | local function foo (howtoclose, obj, n) | 310 | local function foo (howtoclose, obj, n) |
| 311 | local ca -- copy of 'a' visible inside its close metamethod | 311 | local ca -- copy of 'a' visible inside its close metamethod |
| 312 | do | 312 | do |
| 313 | local a <close> = func2close(function (...) | 313 | local a <close> = func2close(function (... | t) |
| 314 | local t = table.pack(...) | ||
| 315 | assert(select("#", ...) == n) | 314 | assert(select("#", ...) == n) |
| 316 | assert(t.n == n and t[1] == ca and (t.n < 2 or t[2] == obj)) | 315 | assert(t.n == n and t[1] == ca and (t.n < 2 or t[2] == obj)) |
| 317 | ca = 15 -- final value to be returned if howtoclose=="scope" | 316 | ca = 15 -- final value to be returned if howtoclose=="scope" |
| @@ -911,8 +910,7 @@ do | |||
| 911 | 910 | ||
| 912 | local extrares -- result from extra yield (if any) | 911 | local extrares -- result from extra yield (if any) |
| 913 | 912 | ||
| 914 | local function check (body, extra, ...) | 913 | local function check (body, extra, ...|t) |
| 915 | local t = table.pack(...) -- expected returns | ||
| 916 | local co = coroutine.wrap(body) | 914 | local co = coroutine.wrap(body) |
| 917 | if extra then | 915 | if extra then |
| 918 | extrares = co() -- runs until first (extra) yield | 916 | extrares = co() -- runs until first (extra) yield |
