From d90a093b69d2f4866467cf1a44a56afa6beb4878 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Mar 2017 13:22:47 +0100 Subject: [PATCH] fixed files form Closure #50 --- .../javascript/jscomp/PeepholeReplaceKnownMethods.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/Closure/50/com/google/javascript/jscomp/PeepholeReplaceKnownMethods.java b/projects/Closure/50/com/google/javascript/jscomp/PeepholeReplaceKnownMethods.java index ffe47d3..afaf85a 100644 --- a/projects/Closure/50/com/google/javascript/jscomp/PeepholeReplaceKnownMethods.java +++ b/projects/Closure/50/com/google/javascript/jscomp/PeepholeReplaceKnownMethods.java @@ -373,7 +373,7 @@ private Node tryFoldArrayJoin(Node n) { Node right = callTarget.getNext(); if (right != null) { - if (!NodeUtil.isImmutableValue(right)) { + if (right.getNext() != null || !NodeUtil.isImmutableValue(right)) { return n; } } @@ -386,7 +386,12 @@ private Node tryFoldArrayJoin(Node n) { return n; } + if (right != null && right.getType() == Token.STRING + && ",".equals(right.getString())) { // "," is the default, it doesn't need to be explicit + n.removeChild(right); + reportCodeChange(); + } String joinString = (right == null) ? "," : NodeUtil.getStringValue(right); List arrayFoldedChildren = Lists.newLinkedList();