Generate anonymous function expressions for getters / setters of an object literal.

Related issue: #234

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
Ruben Ayrapetyan 2015-06-24 15:29:35 +03:00
parent c603d10360
commit 4ff9e79b02
2 changed files with 20 additions and 1 deletions

View File

@ -267,7 +267,7 @@ parse_property_assignment (void)
syntax_add_prop_name (name, is_setter ? PROP_SET : PROP_GET);
skip_newlines ();
const operand func = parse_argument_list (VARG_FUNC_EXPR, name, NULL, NULL);
const operand func = parse_argument_list (VARG_FUNC_EXPR, empty_operand (), NULL, NULL);
dump_function_end_for_rewrite ();

View File

@ -71,3 +71,22 @@ assert (a.property1 === 25);
b = delete a[b];
assert (b === true);
assert (a.property1 === undefined);
flow = '';
a = {
get q ()
{
flow += 'get: ' + (typeof q);
return 0;
},
set q (v)
{
flow += ', set: ' + (typeof q);
}
};
a.q;
a.q = 1;
assert (flow == 'get: undefined, set: undefined');