Fix output for arrays whose last element is a hole: [1,,]
authorDavid Glasser <glasser@davidglasser.net>
Wed, 16 Jan 2013 19:59:19 +0000 (14:59 -0500)
committerMihai Bazon <mihai@bazon.net>
Thu, 18 Jul 2013 12:39:22 +0000 (15:39 +0300)
commitb1febde3e9be32b9d88918ed733efc3796e3f143
tree01d6eb5082dc04ea323ab154e3747259e0b5640c
parent193049af197ee73275dced11289b9b6755f4f469
Fix output for arrays whose last element is a hole: [1,,]

1529ab96 started to do this (by considering holes to be separate from
"undefined") but it still converted
   [1,,]    (length 2, last element hole, trailing comma)
to
   [1,]     (length 1, trailing comma)

Unfortunately the test suite doesn't really make this clear: the new test here
passes with or without this patch because run-tests.js beautifys the expected
output (in "make_code"), which does the incorrect transformation! If you make
some manual change to arrays.js to make the test fail and see the INPUT and
OUTPUT, then you can see that without this fix, [1,,] -> [1,], and with this fix
it stays [1,,].
lib/output.js
test/compress/arrays.js