Implement array/object destructuring (#3305)

This patch implements the core functionality of destructuring patterns.
Function argument/for in-of pattern are currently unsupported.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2019-11-14 13:49:49 +01:00
committed by Zoltan Herczeg
parent b4b55a67a2
commit 213544ae47
19 changed files with 1628 additions and 177 deletions
+28
View File
@@ -76,6 +76,34 @@ parser_module_check_duplicate_import (parser_context_t *context_p, /**< parser c
return false;
} /* parser_module_check_duplicate_import */
/**
* Append an identifier to the exported bindings.
*/
void
parser_module_append_export_name (parser_context_t *context_p) /**< parser context */
{
if (!(context_p->status_flags & PARSER_MODULE_STORE_IDENT))
{
return;
}
context_p->module_identifier_lit_p = context_p->lit_object.literal_p;
ecma_string_t *name_p = ecma_new_ecma_string_from_utf8 (context_p->lit_object.literal_p->u.char_p,
context_p->lit_object.literal_p->prop.length);
if (parser_module_check_duplicate_export (context_p, name_p))
{
ecma_deref_ecma_string (name_p);
parser_raise_error (context_p, PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER);
}
parser_module_add_names_to_node (context_p,
name_p,
name_p);
ecma_deref_ecma_string (name_p);
} /* parser_module_append_export_name */
/**
* Check for duplicated exported bindings.
* @return - true - if the exported name is a duplicate