Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix bug with semi-colons inserted after a cond statement

  • Loading branch information...
commit 852b4d8e787984e4824e62de837e9fd373526442 1 parent 1e72a8f
@smtlaissezfaire authored
Showing with 8 additions and 7 deletions.
  1. +1 −0  lib/loop/uglify.js
  2. +7 −7 test/integration/if-cond-spec.js
View
1  lib/loop/uglify.js
@@ -444,6 +444,7 @@ processStatementOrExpression = function(statementOrExpression) {
if (f.type === 'id' &&
(f.contents === 'var' ||
f.contents === 'if' ||
+ f.contents === 'cond' ||
f.contents === '//')) {
isStatement = false;
}
View
14 test/integration/if-cond-spec.js
@@ -71,7 +71,7 @@ describe("if + cond", function() {
var expected = '';
expected += 'if (true) {\n';
expected += ' console.log(true);\n';
- expected += '};';
+ expected += '}';
assert.equal(loop.compile(code, defaultOptions), expected);
});
@@ -87,7 +87,7 @@ describe("if + cond", function() {
expected += ' console.log(1);\n';
expected += '} else if (true) {\n';
expected += ' console.log(2);\n';
- expected += '};';
+ expected += '}';
assert.equal(loop.compile(code, defaultOptions), expected);
});
@@ -106,7 +106,7 @@ describe("if + cond", function() {
expected += ' console.log(2);\n';
expected += '} else if (true) {\n';
expected += ' console.log(3);\n';
- expected += '};';
+ expected += '}';
assert.equal(loop.compile(code, defaultOptions), expected);
});
@@ -122,7 +122,7 @@ describe("if + cond", function() {
expected += 'if (x === 1) {\n';
expected += ' console.log("1");\n';
expected += ' console.log("2");\n';
- expected += '};';
+ expected += '}';
assert.equal(loop.compile(code, defaultOptions), expected);
});
@@ -135,7 +135,7 @@ describe("if + cond", function() {
var expected = '';
expected += 'if (1) {\n';
expected += ' console.log("1");\n';
- expected += '};';
+ expected += '}';
assert.equal(loop.compile(code, defaultOptions), expected);
});
@@ -151,7 +151,7 @@ describe("if + cond", function() {
expected += ' console.log(1);\n';
expected += '} else {\n';
expected += ' console.log(2);\n';
- expected += '};';
+ expected += '}';
assert.equal(loop.compile(code, defaultOptions), expected);
});
@@ -175,7 +175,7 @@ describe("if + cond", function() {
code += ' (foo))';
var expected = '';
- expected += 'if (foo) {};';
+ expected += 'if (foo) {}';
assert.equal(loop.compile(code, defaultOptions), expected);
});
Please sign in to comment.
Something went wrong with that request. Please try again.