sjbarag / brs

An interpreter for the BrightScript language that runs on non-Roku platforms.
MIT License
114 stars 43 forks source link

fix(lex): Allow JS object properties as identifiers #614

Closed sjbarag closed 3 years ago

sjbarag commented 3 years ago

By using an identifier in a BrightScript file as an index into that object, we accidentally leaked non-Token properties on the KeyWords JS object from the lexer, e.g. return KeyWords["constructor"]. Use hasOwnProperty() to check if an identifier is a BrightScript keyword to avoid returning JavaScript internals as Tokens.

fixes #613