Skip to content

Non-unique variable names within a container #141

@justarandomgeek

Description

@justarandomgeek

The Variables type does not specify that its name should be unique within a cotainer, but it seems that DAP assumes that they are in several places:

This is causing some problems for me, because in Lua it's perfectly valid to do something like this:

local function a()
  local a = 1
  local a = 2
  local a = 3
  local a = 4
  return
end

or

local function a()
  local a = 1
  do
    local a = 2
    print(a) -- uses the second a
  end
  print(a) -- uses the first a again
end

and I've had some complaints from users about getting "the wrong" version of redefined locals.

It seems like the protocol wants me to make a new Scope at every block or something like that, but i don't get enough information from the Lua runtime to do that, and in any case it wouldn't work since redefining within a block is legal anyway.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions