Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix bug with semi-colons inserted after a cond statement

  • Loading branch information...
commit 852b4d8e787984e4824e62de837e9fd373526442 1 parent 1e72a8f
Scott Taylor authored February 24, 2013
1  lib/loop/uglify.js
@@ -444,6 +444,7 @@ processStatementOrExpression = function(statementOrExpression) {
444 444
       if (f.type === 'id' &&
445 445
           (f.contents === 'var' ||
446 446
            f.contents === 'if' ||
  447
+           f.contents === 'cond' ||
447 448
            f.contents === '//')) {
448 449
         isStatement = false;
449 450
       }
14  test/integration/if-cond-spec.js
@@ -71,7 +71,7 @@ describe("if + cond", function() {
71 71
     var expected = '';
72 72
     expected += 'if (true) {\n';
73 73
     expected += '  console.log(true);\n';
74  
-    expected += '};';
  74
+    expected += '}';
75 75
 
76 76
     assert.equal(loop.compile(code, defaultOptions), expected);
77 77
   });
@@ -87,7 +87,7 @@ describe("if + cond", function() {
87 87
     expected += '  console.log(1);\n';
88 88
     expected += '} else if (true) {\n';
89 89
     expected += '  console.log(2);\n';
90  
-    expected += '};';
  90
+    expected += '}';
91 91
 
92 92
     assert.equal(loop.compile(code, defaultOptions), expected);
93 93
   });
@@ -106,7 +106,7 @@ describe("if + cond", function() {
106 106
     expected += '  console.log(2);\n';
107 107
     expected += '} else if (true) {\n';
108 108
     expected += '  console.log(3);\n';
109  
-    expected += '};';
  109
+    expected += '}';
110 110
 
111 111
     assert.equal(loop.compile(code, defaultOptions), expected);
112 112
   });
@@ -122,7 +122,7 @@ describe("if + cond", function() {
122 122
     expected += 'if (x === 1) {\n';
123 123
     expected += '  console.log("1");\n';
124 124
     expected += '  console.log("2");\n';
125  
-    expected += '};';
  125
+    expected += '}';
126 126
 
127 127
     assert.equal(loop.compile(code, defaultOptions), expected);
128 128
   });
@@ -135,7 +135,7 @@ describe("if + cond", function() {
135 135
     var expected = '';
136 136
     expected += 'if (1) {\n';
137 137
     expected += '  console.log("1");\n';
138  
-    expected += '};';
  138
+    expected += '}';
139 139
 
140 140
     assert.equal(loop.compile(code, defaultOptions), expected);
141 141
   });
@@ -151,7 +151,7 @@ describe("if + cond", function() {
151 151
     expected += '  console.log(1);\n';
152 152
     expected += '} else {\n';
153 153
     expected += '  console.log(2);\n';
154  
-    expected += '};';
  154
+    expected += '}';
155 155
 
156 156
     assert.equal(loop.compile(code, defaultOptions), expected);
157 157
   });
@@ -175,7 +175,7 @@ describe("if + cond", function() {
175 175
     code += '  (foo))';
176 176
 
177 177
     var expected = '';
178  
-    expected += 'if (foo) {};';
  178
+    expected += 'if (foo) {}';
179 179
 
180 180
     assert.equal(loop.compile(code, defaultOptions), expected);
181 181
   });

0 notes on commit 852b4d8

Please sign in to comment.
Something went wrong with that request. Please try again.