Skip to content

BUG: 当_ENV作为多重赋值的第一个变量时, 后续变量会错误的识别成局部变量. #9

Open
@1514599514

Description

@1514599514

这是非常罕见的场景, 并且建议避免编写这种代码.

local env = _ENV
_ENV, a = {}, 1
env.print(env.a, a) -- 1 nil

使用parser.compile函数解析得到的state.ast.locals会多出错误的局部变量_ENVa.
整个多重赋值语句都会识别成local变量定义, 不管是a, a.x, a[1]形式, 生成的ast.type字段都会被错误的标识成'local'.

同时也会导致vscode插件错误提示.
image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @1514599514

        Issue actions

          BUG: 当_ENV作为多重赋值的第一个变量时, 后续变量会错误的识别成局部变量. · Issue #9 · LuaLS/LuaParser