diff options
Diffstat (limited to 'compiler.c')
-rw-r--r-- | compiler.c | 49 |
1 files changed, 6 insertions, 43 deletions
@@ -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 |