summaryrefslogtreecommitdiffhomepage
path: root/compiler.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-01-18 15:28:00 +0100
committerJo-Philipp Wich <jo@mein.io>2022-01-18 15:28:00 +0100
commit03b6a8efc1834a4114f0d11e1a7cecff3242b305 (patch)
treef3b620b35ca765f32af4dd10aa29794be805c53a /compiler.c
parent61d0a34fb7501a1f8aa43cfa1063c8a7ca1fb1d2 (diff)
syntax: drop legacy syntax support
Drop support for the `local` keyword and `delete` function calls. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c49
1 files changed, 6 insertions, 43 deletions
diff --git a/compiler.c b/compiler.c
index c5b0ee5..818576b 100644
--- a/compiler.c
+++ b/compiler.c
@@ -972,52 +972,15 @@ uc_compiler_compile_delete(uc_compiler_t *compiler)
uc_chunk_t *chunk = uc_compiler_current_chunk(compiler);
uc_vm_insn_t type;
-#ifndef NO_LEGACY
- /* If the delete keyword is followed by an opening paren, it might be a
- * legacy delete(object, propname) call */
- if (uc_compiler_parse_match(compiler, TK_LPAREN)) {
- uc_compiler_parse_precedence(compiler, P_ASSIGN);
-
- if (uc_compiler_parse_match(compiler, TK_RPAREN)) {
- type = chunk->entries[compiler->last_insn];
-
- if (type != I_LVAL)
- uc_compiler_syntax_error(compiler, 0,
- "expecting a property access expression");
-
- chunk->entries[compiler->last_insn] = I_DELETE;
- }
- else if (uc_compiler_parse_match(compiler, TK_COMMA)) {
- if (uc_compiler_is_strict(compiler)) {
- uc_compiler_syntax_error(compiler, 0,
- "attempt to apply 'delete' operator on non-property access expression");
- }
- else {
- uc_compiler_parse_precedence(compiler, P_ASSIGN);
- uc_compiler_emit_insn(compiler, 0, I_DELETE);
- uc_compiler_parse_consume(compiler, TK_RPAREN);
- }
- }
- else {
- uc_compiler_syntax_error(compiler, 0, "expecting ')' or ','");
- }
- }
-
- /* Otherwise compile expression, ensure that it results in a property
- * access (I_LVAL) and overwrite it with delete operation. */
- else
-#endif /* NO_LEGACY */
- {
- uc_compiler_parse_precedence(compiler, P_UNARY);
+ uc_compiler_parse_precedence(compiler, P_UNARY);
- type = chunk->entries[compiler->last_insn];
+ type = chunk->entries[compiler->last_insn];
- if (type != I_LVAL)
- uc_compiler_syntax_error(compiler, 0,
- "expecting a property access expression");
+ if (type != I_LVAL)
+ uc_compiler_syntax_error(compiler, 0,
+ "expecting a property access expression");
- chunk->entries[compiler->last_insn] = I_DELETE;
- }
+ chunk->entries[compiler->last_insn] = I_DELETE;
}
static uc_vm_insn_t