Carpet

Carpet

2M Downloads

`var` can assign and query variables with illegal names

altrisi opened this issue ยท 2 comments

commented

Example:

2a = 5; // ==> error:  'a' is not allowed after '2'
var('2a') = 5; // ==> 5 (completes unexceptionally)
commented

This may break back compat, because in ye olden days people used to use var() function cos maps weren't a thing yet. I am in favour of this, but that's just a history of this bug for anyone interested. How hard would it be to detect tho? Cos afaik that error arises in the Tokeniser. Tho ig that also makes it rly easy to check, just need to copy some of the code over.

commented

But I'd assume these old variable names would be legal.

The bug is at runtime, the variable name is evaluated when calling the function.