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:
committed by
Zoltan Herczeg
parent
b4b55a67a2
commit
213544ae47
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user