Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

[bug] return does not accept variables #2

@vurvdev

Description

@vurvdev

Describe the bug
If you try and return with anything but a literal, it will fail, with the token seemingly being skipped or just not existing at all.

To Reproduce

function foo() {
	let bar = 55;
	return bar; // FAIL: "Expected ; after return", as it finds the semicolon instead of the identifier in the parser
};

Expected behaviour
Return works with identifiers.

Additional context
The tokenizer works fine. Inspecting the output tokens gives proper identifiers and semicolons. This is something incredibly cursed with the parser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-CompilerDealing with the compiler (analyzer, tokenizer, parser, transpiler)P-LowT-BugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions