Skip to content

Inconsistentcy in top-level variable handling in non-module files #720

Description

@ark120202

Playground

Input:

const obj = { value1: 1, value2: 2 };
const value1 = obj.value1;
const { value2 } = obj;

function fun1() {}
const fun2 = () => {};

Current Result:

local obj = {value1 = 1, value2 = 2}
local value1 = obj.value1
value2 = obj.value2
function fun1(self)
end
local fun2
fun2 = function()
end

Expected Result:

Either never use local for top-level variables in non-modules or always use local (ref #564).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions