Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request mishoo#216 from jasondavies/sparse-arrays
Browse files Browse the repository at this point in the history
Fix sparse array literals e.g. [,]
  • Loading branch information
mishoo committed Sep 6, 2011
2 parents 07041f7 + 87d8f58 commit 1e7cd25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/process.js
Expand Up @@ -1711,8 +1711,8 @@ function gen_code(ast, options) {
},
"array": function(elements) {
if (elements.length == 0) return "[]";
return add_spaces([ "[", add_commas(MAP(elements, function(el){
if (!beautify && el[0] == "atom" && el[1] == "undefined") return "";
return add_spaces([ "[", add_commas(MAP(elements, function(el, i){
if (!beautify && el[0] == "atom" && el[1] == "undefined") return i === elements.length - 1 ? "," : "";
return parenthesize(el, "seq");
})), "]" ]);
},
Expand Down

0 comments on commit 1e7cd25

Please sign in to comment.