aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compress.js4
-rw-r--r--test/compress/collapse_vars.js4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 872e2bbf..9504241b 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1264,6 +1264,7 @@ merge(Compressor.prototype, {
if (stat_index == 0 && compressor.option("unused")) extract_args();
// Find collapsible assignments
var hit_stack = [];
+ var declare_only = Object.create(null);
extract_candidates(statements[stat_index]);
while (candidates.length > 0) {
hit_stack = candidates.pop();
@@ -1574,6 +1575,8 @@ merge(Compressor.prototype, {
candidates.push(hit_stack.slice());
}
extract_candidates(expr.value);
+ } else {
+ declare_only[expr.name.name] = (declare_only[expr.name.name] || 0) + 1;
}
}
hit_stack.pop();
@@ -1739,6 +1742,7 @@ merge(Compressor.prototype, {
if (!member(expr.name, def.orig)) return;
var referenced = def.references.length - def.replaced;
var declared = def.orig.length - def.eliminated;
+ declared -= declare_only[def.name] || 0;
if (declared > 1 && !(expr.name instanceof AST_SymbolFunarg)) {
mangleable_var(expr.value);
return make_node(AST_SymbolRef, expr.name, expr.name);
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 17d9c981..ac87d788 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -2205,8 +2205,8 @@ var_defs: {
}
expect: {
var f1 = function(x, y) {
- var r = x + y, z = r * r - r, b = 7;
- console.log(z + b);
+ var r = x + y, a = r * r - r, b = 7;
+ console.log(a + b);
};
f1("1", 0);
}
d>Julien Lepiller * doc/contributing.texi: Replace link to TP with a link to Weblate. * doc/guix.texi: Replace link to TP with a link to Weblate. * doc/guix-cookbook.texi: Replace link to TP with a link to Weblate. 2020-12-23doc: cookbook: Fix "fiction-less" typo.Pierre Neidhardt * doc/guix-cookbook.texi (Guix Profiles in Practice): Change "friction-less" to "frictionless". 2020-10-17doc: cookbook: Balance parens in custom kernel examples.Ludovic Courtès * doc/guix-cookbook.texi (Customizing the Kernel): Add missing paren in example. Remove extra parens in other example. 2020-10-15doc: cookbook: Clarify what keywords are.Ludovic Courtès * doc/guix-cookbook.texi (A Scheme Crash Course): Clarify what keywords are. 2020-10-15doc: Add "Build Utilities" section.Ludovic Courtès * doc/guix.texi (Build Utilities): New section. (Defining Packages): Refer to it. (Build Systems): Likewise. * doc/guix-cookbook.texi (Extended example): Likewise. 2020-10-15doc: cookbook: Use @code for the identifiers of utility functions.Ludovic Courtès * doc/guix-cookbook.texi (Utility functions): Use @code instead of @asis. 2020-10-15doc: cookbook: More "#true" and "#false".Ludovic Courtès * doc/guix-cookbook.texi (Extended example) (Customizing the Kernel, Running Guix on a Linode Server): Use #true and #false. 2020-10-15doc: cookbook: Use @var for meta-syntactic variables.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Use @var for meta-syntactic variables in 'modify-phases' description. 2020-10-15doc: cookbook: Fix 'let' form in example.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Fix 'let' form in example. 2020-10-14services: nginx: Add lua module.Oleg Pykhalov * gnu/services/web.scm (<nginx-configuration>) [lua-package-path, lua-package-cpath]: New record types. * gnu/services/web.scm (default-nginx-config): Use them. * doc/guix.texi (Web Services): Document this. * doc/guix-cookbook.texi (System Configuration): Document this. 2020-10-14doc: cookbook: Mention "#true" and "#false".Ludovic Courtès * doc/guix-cookbook.texi (A Scheme Crash Course): Mention "#true" and "#false". (Extended example): Likewise. 2020-09-09doc: cookbook: Adding a section "Running Guix on a Linode Server"Joshua Branson * doc/guix-cookbook.texi (Running Guix on a Linode Server): I added a section that explains how to run guix on a linode server. Thanks Chris Webber! Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-08-23doc: cookbook: Add chapter about Guix environment.Oleg Pykhalov * doc/guix-cookbook.texi (Environment management): New chapter. 2020-07-09doc: cookbook: Fix ‘file system’ spelling.Tobias Geerinckx-Rice * doc/guix-cookbook.texi (Getting help, Customizing the Kernel): Fix ‘file system’ spelling. 2020-06-28doc: cookbook: Fix encoding of "André".Ludovic Courtès This is a followup to f8945734a5abff69644284231cc47fb67456657b. * doc/guix-cookbook.texi: Encode "André" as UTF-8, not ISO-8859-1. 2020-06-28doc: cookbook: Update entry about getting substitutes through Tor.André Batista * doc/guix-cookbook.texi (Getting substitutes from Tor): Update section warning to mention the use of torsocks when pulling. 2020-06-23doc: cookbook: Fix typos.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Fix typos. 2020-06-23doc: cookbook: Tweak intro to the REPL.Ludovic Courtès * doc/guix-cookbook.texi (A Scheme Crash Course): Reword first paragraph. Remove extra paren. 2020-06-23doc: cookbook: Mention "guix hash -rx" for Git checkouts.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Mention "guix hash -rx ." 2020-06-23doc: cookbook: Clarify 'git-fetch' conventions.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Clarify use of 'git-file-name' and 'git-version'. 2020-06-04doc: cookbook: Add entry about getting substitutes through Tor.Brice Waegeneire * doc/guix-cookbook.texi (Getting substitutes from Tor): New section. 2020-06-02doc: cookbook: Add entry about Wireguard VPN.Marcin Karpezo Co-authored-by: Brice Waegeneire <brice@waegenei.re> * doc/guix-cookbook.texi (Connect to Wireguard VPN): New section. 2020-05-25doc: cookbook: Add subsection about session locking with xss-lock.Chris Bøg * doc/guix-cookbook.texi (Session lock): New node. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-05-05doc: cookbook: Fix sbcl-ttf-fonts package name.Jean-Baptiste Note * doc/guix-cookbook.texi (StumpWM): Adjust sbcl-ttf-fonts package name. Signed-off-by: Marius Bakke <mbakke@fastmail.com> 2020-04-30doc: cookbook: Rename stumpwm package to current state.Marcin Karpezo * doc/guix-cookbook.texi (StumpWM): Rename STUMPWM package to current state. Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com> 2020-04-25doc: cookbook: Fix quotes.Nicolas Goaziou * doc/guix-cookbook.texi (Basic setup with manifests): (Default profile): (The benefits of manifests): Use proper quotes in regular texts. 2020-04-24doc: cookbook: Use @file for file names and extensions.Nicolas Goaziou * doc/guix-cookbook.texi (@samp{GUIX_PACKAGE_PATH}): (Extended example): (Setting up a bind mount): (Basic setup with manifests): (Default profile): Use @file instead of @samp or @code for file names and extensions. 2020-04-24doc: cookbook: Fix misuses of double spacing.Nicolas Goaziou * doc/guix-cookbook.texi (Extended example): (StumpWM): (Basic setup with manifests): Prevent Texinfo from ending a sentence where it should not. (Setting up a bind mount): Add two spaces where needed. 2020-04-22doc: cookbook: Explain how to use bind mounts.Matthew Brooks * doc/guix-cookbook.texi (Setting up a bind mount): Add example. Signed-off-by: Leo Famulari <leo@famulari.name> 2020-03-30gnu: Add sbcl-stumpwm-ttf-fonts.Oleg Pykhalov * gnu/packages/wm.scm (sbcl-stumpwm-ttf-fonts): New variable. * doc/guix-cookbook.texi (Customizing a Window Manager): Document SBCL-STUMPWM-TTF-FONTS installation and configuration. 2020-01-17doc: cookbook: Avoid URL reference to the manual.Ludovic Courtès * doc/guix-cookbook.texi (Other build systems): Use @xref instead of @uref, and remove section number. 2019-11-26doc: cookbook: Add cross-references to the Guile manual.Ludovic Courtès * doc/guix-cookbook.texi (A Scheme Crash Course): Add cross-reference to the Guile manual. 2019-11-26doc: cookbook: Use @result{} & co. instead of a '>' prompt.Ludovic Courtès * doc/guix-cookbook.texi (A Scheme Crash Course) (Extended example): Use @result{}, @print{}, and @error{}. 2019-11-26doc: cookbook: Use Texinfo quotes.Ludovic Courtès * doc/guix-cookbook.texi: Use Texinfo quotes ``like this'' instead of straight quotes or curly quotes. 2019-11-26doc: cookbook: Add cross-reference about ./pre-inst-env.Ludovic Courtès * doc/guix-cookbook.texi (Direct checkout hacking): Refer to "Running Guix Before It Is Installed". 2019-11-26doc: cookbook: Use @lisp for Scheme snippets.Ludovic Courtès * doc/guix-cookbook.texi: Use @lisp instead of @example where appropriate. 2019-10-30doc: Explain how to switch profile from empty shell in "Profiles in Practice".Pierre Neidhardt * doc/guix-cookbook.texi (Profiles in Practice): Add example. 2019-10-28doc: Link to SICP Info page in "A Scheme Crash Course".Pierre Neidhardt * doc/guix-cookbook.texi (Scheme tutorials): Replace Emacs Info reader hint with more useful interactive link to SICP Info page. 2019-10-28doc: Finish importing the "Packaging Tutorial".Pierre Neidhardt * doc/guix-cookbook.texi (Packaging Tutorial): Import all sections after the Scheme crash course. 2019-10-28doc: Fix some typos in "Guix Profiles in Practice".Pierre Neidhardt * doc/guix-cookbook.texi (Guix Profiles in Practice): Fix typos. 2019-10-25doc: cookbook: Use "@lisp" for Scheme snippets.Ludovic Courtès * doc/guix-cookbook.texi: Use @lisp for Scheme snippets instead of "@example scheme". This allows for syntax highlighting of the HTML output. 2019-10-24doc: Add "Guix Profiles in Practice" to the cookbook.Pierre Neidhardt * doc/guix-cookbook.texi (Advanced package management): New chapter. * doc/guix-cookbook.texi (Guix Profiles in Practice): New section. 2019-09-18doc: Add Guix Cookbook.Ricardo Wurmus * .gitignore: Update ignore list. * Makefile.am (assert-no-store-file-names): Exclude the cookbook. * bootstrap: Generate po files for cookbook translations. * doc/guix-cookbook.texi: New file. * doc/local.mk (info_TEXINFOS): Add it; add a rule to build cookbook translations. * po/doc/local.mk (DOC_COOKBOOK_PO_FILES): New variable. (EXTRA_DIST): Add cookbook pot file and po files. (doc-po-update-cookbook-%): New target. (doc-pot-update): Also update cookbook pot file. (doc-po-update): Also update cookbook po files.