aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compress.js1
-rw-r--r--lib/output.js2
-rw-r--r--test/compress/loops.js18
3 files changed, 20 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index cbcb7b86..3804a932 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2327,6 +2327,7 @@ merge(Compressor.prototype, {
};
OPT(AST_For, function(self, compressor){
+ if (is_empty(self.init)) self.init = null;
if (!compressor.option("loops")) return self;
if (self.condition) {
var cond = self.condition.evaluate(compressor);
diff --git a/lib/output.js b/lib/output.js
index 767abd4d..c0f10523 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -799,7 +799,7 @@ function OutputStream(options) {
output.print("for");
output.space();
output.with_parens(function(){
- if (self.init && !(self.init instanceof AST_EmptyStatement)) {
+ if (self.init) {
if (self.init instanceof AST_Definitions) {
self.init.print(output);
} else {
diff --git a/test/compress/loops.js b/test/compress/loops.js
index b55c6162..c8d77840 100644
--- a/test/compress/loops.js
+++ b/test/compress/loops.js
@@ -440,3 +440,21 @@ issue_186_beautify_bracketize_ie8: {
'}',
]
}
+
+issue_1648: {
+ options = {
+ join_vars: true,
+ loops: true,
+ passes: 2,
+ sequences: true,
+ unused: true,
+ }
+ input: {
+ function f() {
+ x();
+ var b = 1;
+ while (1);
+ }
+ }
+ expect_exact: "function f(){for(x();1;);}"
+}
/packages/kde-utils.scm (krusader)[description]: Likewise. * gnu/packages/language.scm (praat)[description]: Likewise. * gnu/packages/linux.scm (light)[description]: Likewise. * gnu/packages/lisp-xyz.scm (sbcl-hu.dwim.defclass-star)[description]: Likewise. * gnu/packages/mail.scm (dovecot-trees, sieve-connect)[description]: Likewise. * gnu/packages/ocaml.scm (ocaml-opam-file-format, ocaml-cppo) (ocaml4.07-ppx-variants-conv)[description]: Likewise. * gnu/packages/perl.scm (perl-convert-binhex)[description]: Likewise. * gnu/packages/python-crypto.scm (python-ecdsa)[description]: Likewise. * gnu/packages/python-web.scm (python-html5lib)[synopsis, description]: Likewise. (python-venusian)[synopsis]: Likewise. * gnu/packages/python-xyz.scm (python-readlike, python-gssapi) (python-flufl-i18n)[description]: Likewise. (python-pox, python-watchdog, python-xattr)[synopsis, description]: Likewise. * gnu/packages/ruby.scm (ruby-sorcerer)[description]: Likewise. * gnu/packages/rust-apps.scm (watchexec)[description]: Likewise. * gnu/packages/rust.scm (mrustc)[synopsis]: Likewise. * gnu/packages/shells.scm (s-shell)[description]: Likewise. * gnu/packages/ssh.scm (sshpass)[description]: Likewise. * gnu/packages/terminals.scm (beep)[description]: Likewise. * gnu/packages/web.scm (perl-lwp-useragent-cached)[description]: Likewise. * gnu/packages/wv.scm (wv)[description]: Likewise. Tobias Geerinckx-Rice 2020-08-28gnu: guile-ssh: Update to 0.13.1....* gnu/packages/ssh.scm (guile-ssh): Update to 0.13.1. Ludovic Courtès