Skip to content

for loop variables not recognized upon assignment #44

@nilnor

Description

@nilnor

I noticed that for loop variables are not recognized as being locals when they are the target of assignments.

To illustrate, the following moonscript:

for k,v in ipairs t
  v = v .. 'foo'

Transpiles down to:

for k, v in ipairs(t) do
  local v = v .. 'foo'
end

When I would have expected the following Lua output:

for k, v in ipairs(t) do
  v = v .. 'foo'
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions