Implementing assignment of number literal values in 'assignment' opcode handler.

This commit is contained in:
Ruben Ayrapetyan
2014-07-21 19:22:25 +04:00
parent 84131d9a28
commit ff4d3e4af3
2 changed files with 21 additions and 0 deletions
+19
View File
@@ -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();
}
+2
View File
@@ -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)
};