Skip to content

forward declaration of local variable without an assignment throws ParseException #110

@CodeSmile-0000011110110111

Description

It is legal to do a forward declaration of a local variable without initializing it and follow it up with a comment:

local theVar -- will be assigned later
local anotherVar -- also assigned later

However this throws a ParseException in a minimal test case project.

Assigning a value makes it work:

local theVar = 0 -- not throwing

The same works fine in a Lua online compiler, ie this one:
https://www.tutorialspoint.com/compilers/online-lua-compiler.htm

Edit: Looks like an assignment is expected in this case, a forward-declaration is just not considered by the code as a valid statement.

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