diff --git a/src/libcoreint/opcodes.c b/src/libcoreint/opcodes.c index ba87a2be2..f2910521f 100644 --- a/src/libcoreint/opcodes.c +++ b/src/libcoreint/opcodes.c @@ -13,6 +13,7 @@ * limitations under the License. */ +#include "ecma-alloc.h" #include "ecma-exceptions.h" #include "ecma-helpers.h" #include "ecma-operations.h" @@ -271,7 +272,25 @@ opfunc_assignment (OPCODE opdata, /**< operation data */ break; } case OPCODE_ARG_TYPE_NUMBER: + { + ecma_Number_t *num_p = ecma_AllocNumber(); + *num_p = get_number_by_idx( src_val_descr); + + right_value.m_ValueType = ECMA_TYPE_NUMBER; + ecma_SetPointer( right_value.m_Value, num_p); + + break; + } case OPCODE_ARG_TYPE_SMALLINT: + { + ecma_Number_t *num_p = ecma_AllocNumber(); + *num_p = src_val_descr; + + right_value.m_ValueType = ECMA_TYPE_NUMBER; + ecma_SetPointer( right_value.m_Value, num_p); + + break; + } JERRY_UNIMPLEMENTED(); } diff --git a/tests/unit/test_assignment_opcode.c b/tests/unit/test_assignment_opcode.c index 38ce4fabb..550c26e2a 100644 --- a/tests/unit/test_assignment_opcode.c +++ b/tests/unit/test_assignment_opcode.c @@ -30,6 +30,8 @@ main( int __unused argc, getop_var_decl( 1), getop_assignment( 0, OPCODE_ARG_TYPE_STRING, 1), getop_assignment( 1, OPCODE_ARG_TYPE_VARIABLE, 0), + getop_assignment( 0, OPCODE_ARG_TYPE_SMALLINT, 253), + getop_assignment( 1, OPCODE_ARG_TYPE_NUMBER, 2), getop_exitval( 0) };