Skip to content

Lossless parser gives wrong output on vararg function parameters. #7

@wally2471

Description

@wally2471

Very simple repro.

local parser = require "./luaup/lossless/parse"
local util = require "./luaup/lossless/util"

local func_cst = parser([[
    local function hi(...)
    end

    local t = { ... }
    local function wow(this, is, an, arg, ...)
    end
]]).cst

print(util.tostring(func_cst))

Currently gives:

local function hi()...
    end

    local t = { ... }
    local function wow(this, is, an, arg,) ...
    end

Expected:

local function hi(...)
end

local t = { ... }
local function wow(this, is, an, arg, ...)
end

Thank you for taking time to look into this :)

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