guybedford / es-module-lexer

Low-overhead lexer dedicated to ES module parsing for fast analysis
MIT License
912 stars 47 forks source link

fix: handling of of keyword #174

Closed guybedford closed 2 months ago

guybedford commented 2 months ago

Fixes a bug introduced in https://github.com/guybedford/es-module-lexer/pull/171 where the of keyword is not a banned keyword so isn't enough to check on its own. Instead this updates the check to verify the paren context to see if we are in a for statement or not instead of having of handled in the isExpressionKeyword function. I also verified again all the keywords in the isExpressionKeyword function are valid failures otherwise so this does fix the root cause.