Skip to content

Commit 4ff9e79

Browse files
Generate anonymous function expressions for getters / setters of an object literal.
Related issue: #234 JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
1 parent c603d10 commit 4ff9e79

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

jerry-core/parser/js/parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ parse_property_assignment (void)
267267
syntax_add_prop_name (name, is_setter ? PROP_SET : PROP_GET);
268268

269269
skip_newlines ();
270-
const operand func = parse_argument_list (VARG_FUNC_EXPR, name, NULL, NULL);
270+
const operand func = parse_argument_list (VARG_FUNC_EXPR, empty_operand (), NULL, NULL);
271271

272272
dump_function_end_for_rewrite ();
273273

tests/jerry/object-literal.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,22 @@ assert (a.property1 === 25);
7171
b = delete a[b];
7272
assert (b === true);
7373
assert (a.property1 === undefined);
74+
75+
flow = '';
76+
a = {
77+
get q ()
78+
{
79+
flow += 'get: ' + (typeof q);
80+
81+
return 0;
82+
},
83+
set q (v)
84+
{
85+
flow += ', set: ' + (typeof q);
86+
}
87+
};
88+
89+
a.q;
90+
a.q = 1;
91+
92+
assert (flow == 'get: undefined, set: undefined');

0 commit comments

Comments
 (0)