RegExp: treat undefined argument as empty.

new RegExp() and new RegExp(undefined) calls now results in the
same 'source' pattern.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
Peter Gal
2015-07-20 13:12:52 +02:00
parent 336db40ed0
commit e34ab90e61
2 changed files with 13 additions and 1 deletions
@@ -78,7 +78,7 @@ ecma_builtin_regexp_dispatch_construct (const ecma_value_t *arguments_list_p, /*
}
}
if (arguments_list_len == 0)
if (arguments_list_len == 0 || ecma_is_value_undefined (arguments_list_p[0]))
{
ecma_string_t *magic_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP);
ret_value = ecma_op_create_regexp_object (magic_str_p, NULL);