Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message for illegal yield in classic mode #833

Open
bnoordhuis opened this issue Jan 18, 2025 · 0 comments
Open

Better error message for illegal yield in classic mode #833

bnoordhuis opened this issue Jan 18, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@bnoordhuis
Copy link
Contributor

async function g() { // note: not a generator function
    yield 42;        // same error message without the semicolon
}

Raises unexpected 'yield' keyword in ESM mode but expecting ';' in classic mode.

It's not strictly wrong because yield is a valid identifier in classic mode (you get the same error with yolo 42) but it's unhelpful.

@bnoordhuis bnoordhuis added the enhancement New feature or request label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant