Reflect.parse: ArrayExpression elements that are SequenceExpressions are discarded

RESOLVED FIXED in mozilla17

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: jorendorff, Assigned: dherman)

Tracking

Other Branch
mozilla17
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
js> Reflect.parse("[0, (1,2)]", {loc:0}).body[0].expression.elements
[{loc:null, type:"Literal", value:0}, ,]
(Assignee)

Comment 1

5 years ago
Created attachment 653423 [details] [diff] [review]
fixes handling of array holes
Assignee: general → dherman
Attachment #653423 - Flags: review?(jorendorff)

Comment 2

5 years ago
Related Esprima bugs:

http://code.google.com/p/esprima/issues/detail?id=321
http://code.google.com/p/esprima/issues/detail?id=322
(Reporter)

Comment 3

5 years ago
Comment on attachment 653423 [details] [diff] [review]
fixes handling of array holes

Review of attachment 653423 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jsreflect.cpp
@@ +2921,5 @@
>      if (!elts.reserve(pn->pn_count))
>          return false;
>  
>      for (ParseNode *next = pn->pn_head; next; next = next->pn_next) {
> +        /* Comma expressions can't occur inside patterns, so no need to test pn_count. */

Heh. Logic is good. Logic and a JS_ASSERT is better.

::: js/src/tests/js1_8_5/extensions/reflect-parse.js
@@ +333,5 @@
>  assertExpr("[,,,1,2,3,]", arrExpr([,,,lit(1),lit(2),lit(3),]));
>  assertExpr("[,,,1,2,3,,]", arrExpr([,,,lit(1),lit(2),lit(3),,]));
>  assertExpr("[,,,1,2,3,,,]", arrExpr([,,,lit(1),lit(2),lit(3),,,]));
>  assertExpr("[,,,,,]", arrExpr([,,,,,]));
> +assertExpr("[,,,,,]", arrExpr([null,null,null,null,null]));

You meant to remove the previous one, right?

In fact, shouldn't all these change to have nulls in the expected result?
Attachment #653423 - Flags: review?(jorendorff) → review+
(Assignee)

Comment 4

5 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/67ff83142ba5
https://hg.mozilla.org/mozilla-central/rev/67ff83142ba5
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in before you can comment on or make changes to this bug.