Skip to content

Commit 3fef099

Browse files
committed
for .. in should only treat the first variable as const
1 parent 744156b commit 3fef099

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
## 3.16.4
77
* `FIX` (VSCode) Broken `view document`
8-
8+
* `FIX` `for .. in` should only treat the first variable as const
99

1010
## 3.16.3
1111
`2025-12-23`

script/parser/compile.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4098,9 +4098,9 @@ local function parseFor()
40984098
for i = 1, #list do
40994099
local obj = list[i]
41004100
---@cast obj parser.object
4101-
-- In Lua 5.5, for loop variables are treated as constants
4101+
-- In Lua 5.5, for first loop variable is treated as constant
41024102
local attrs
4103-
if State.version == 'Lua 5.5' then
4103+
if i == 1 and State.version == 'Lua 5.5' then
41044104
attrs = {
41054105
type = 'localattrs',
41064106
start = obj.start,

0 commit comments

Comments
 (0)