Fix eval fail with empty string

Fixes #278

JerryScript-DCO-1.0-Signed-off-by: pius.lee pius.lee@samsung.com
This commit is contained in:
pius.lee
2015-12-04 13:46:19 +09:00
committed by Ruben Ayrapetyan
parent 21f561f8ef
commit cc60b0b3a2
+7
View File
@@ -47,6 +47,12 @@ ecma_op_eval (ecma_string_t *code_p, /**< code string */
ecma_completion_value_t ret_value; ecma_completion_value_t ret_value;
lit_utf8_size_t chars_num = ecma_string_get_size (code_p); lit_utf8_size_t chars_num = ecma_string_get_size (code_p);
if (chars_num == 0)
{
ret_value = ecma_make_normal_completion_value (ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED));
}
else
{
MEM_DEFINE_LOCAL_ARRAY (code_utf8_buffer_p, MEM_DEFINE_LOCAL_ARRAY (code_utf8_buffer_p,
chars_num, chars_num,
lit_utf8_byte_t); lit_utf8_byte_t);
@@ -63,6 +69,7 @@ ecma_op_eval (ecma_string_t *code_p, /**< code string */
is_called_from_strict_mode_code); is_called_from_strict_mode_code);
MEM_FINALIZE_LOCAL_ARRAY (code_utf8_buffer_p); MEM_FINALIZE_LOCAL_ARRAY (code_utf8_buffer_p);
}
return ret_value; return ret_value;
} /* ecma_op_eval */ } /* ecma_op_eval */