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

'yield' parsed as keyword instead of identifier #1918

PetarMax opened this Issue Mar 8, 2018 · 0 comments


None yet
1 participant

PetarMax commented Mar 8, 2018

In the file src/scanner.ts, in the function isKeyword, yield is treated as a keyword, which is incorrect. This should be handled by the function nextToken() in src/parser.ts, where there already exists an appropriate test for strictness and reserved words in strict mode.

Steps to reproduce

esprima.parseScript('yield : 1')

Expected output

Valid syntax tree.

Actual output

Error: Line 1: Unexpected token :

Relevant references states that yield is a keyword only in strict mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment