diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-05-18 10:45:21 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-05-18 13:11:33 +0200 |
commit | ff6811f29065951ab3917460f3d76ffe6ddb0c81 (patch) | |
tree | 7d3925b2640c9dfc07959faaf866699d77a30d00 /lexer.c | |
parent | 5803d8605b84ef362cc7f96f9e523eff5d0d81bc (diff) |
syntax: implement `delete` as proper operator
Turn `delete` into a proper operator mimicking ECMAScript semantics.
Also ensure to transparently turn deprecated `delete(obj, propname)`
function calls into `delete obj.propname` expressions during compilation.
When strict mode is active, legacy delete() calls throw a syntax error
instead.
Finally drop the `delete()` function from the stdlib as it is shadowed
by the delete operator syntax now.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lexer.c')
-rw-r--r-- | lexer.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -141,6 +141,7 @@ static const struct keyword reserved_words[] = { { TK_ENDWHILE, "endwhile", 8, { 0 } }, { TK_FUNC, "function", 8, { 0 } }, { TK_DEFAULT, "default", 7, { 0 } }, + { TK_DELETE, "delete", 6, { 0 } }, { TK_RETURN, "return", 6, { 0 } }, { TK_ENDFOR, "endfor", 6, { 0 } }, { TK_SWITCH, "switch", 6, { 0 } }, |