Last Comment Bug 632027 - Reflect.parse: ArrayExpression elements that are SequenceExpressions are discarded
: Reflect.parse: ArrayExpression elements that are SequenceExpressions are disc...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Other Branch
: All All
: -- normal (vote)
: mozilla17
Assigned To: Dave Herman [:dherman]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-07 07:29 PST by Jason Orendorff [:jorendorff]
Modified: 2012-08-25 08:47 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fixes handling of array holes (4.43 KB, patch)
2012-08-20 10:09 PDT, Dave Herman [:dherman]
jorendorff: review+
Details | Diff | Splinter Review

Description Jason Orendorff [:jorendorff] 2011-02-07 07:29:24 PST
js> Reflect.parse("[0, (1,2)]", {loc:0}).body[0].expression.elements
[{loc:null, type:"Literal", value:0}, ,]
Comment 1 Dave Herman [:dherman] 2012-08-20 10:09:17 PDT
Created attachment 653423 [details] [diff] [review]
fixes handling of array holes
Comment 3 Jason Orendorff [:jorendorff] 2012-08-22 12:35:55 PDT
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?
Comment 5 Ryan VanderMeulen [:RyanVM] 2012-08-25 08:47:21 PDT
https://hg.mozilla.org/mozilla-central/rev/67ff83142ba5

Note You need to log in before you can comment on or make changes to this bug.