From 450096531699a882ba4824bf2ce72ad7f09359a0 Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Wed, 28 Oct 2015 18:52:39 +0300 Subject: [PATCH] Fix handling of non-reference operands in prefix operations. JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com --- jerry-core/parser/js/opcodes-dumper.cpp | 2 +- tests/jerry/arithmetics-2.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/jerry-core/parser/js/opcodes-dumper.cpp b/jerry-core/parser/js/opcodes-dumper.cpp index 60552f82f..cea762e12 100644 --- a/jerry-core/parser/js/opcodes-dumper.cpp +++ b/jerry-core/parser/js/opcodes-dumper.cpp @@ -1225,7 +1225,7 @@ check_operand_in_prefix_operation (jsp_operand_t obj) /**< operand, which type s const op_meta last = last_dumped_op_meta (); if (last.op.op_idx != VM_OP_PROP_GETTER) { - if (obj.is_empty_operand ()) + if (obj.is_register_operand ()) { /* * FIXME: diff --git a/tests/jerry/arithmetics-2.js b/tests/jerry/arithmetics-2.js index 0e8c34257..83c1b1891 100644 --- a/tests/jerry/arithmetics-2.js +++ b/tests/jerry/arithmetics-2.js @@ -43,3 +43,11 @@ assert (++o.p === 2); assert (o.p === 2); assert (--o.p === 1); assert (o.p === 1); + +try { + eval ('++ ++ a'); + assert (false); +} +catch (e) { + assert (e instanceof ReferenceError); +}