path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/functions.js150
1 files changed, 150 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 83a27a06..888c6e3c 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -1496,3 +1496,153 @@ issue_2657: {
}
expect_stdout: "42"
}
+
+issue_2663_1: {
+ options = {
+ inline: true,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (function() {
+ var i, o = {};
+ function createFn(j) {
+ return function() {
+ console.log(j);
+ };
+ }
+ for (i in { a: 1, b: 2, c: 3 })
+ o[i] = createFn(i);
+ for (i in o)
+ o[i]();
+ })();
+ }
+ expect: {
+ (function() {
+ var i, o = {};
+ function createFn(j) {
+ return function() {
+ console.log(j);
+ };
+ }
+ for (i in { a: 1, b: 2, c: 3 })
+ o[i] = createFn(i);
+ for (i in o)
+ o[i]();
+ })();
+ }
+ expect_stdout: [
+ "a",
+ "b",
+ "c",
+ ]
+}
+
+issue_2663_2: {
+ options = {
+ inline: true,
+ reduce_vars: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ (function() {
+ var i;
+ function fn(j) {
+ return function() {
+ console.log(j);
+ }();
+ }
+ for (i in { a: 1, b: 2, c: 3 })
+ fn(i);
+ })();
+ }
+ expect: {
+ (function() {
+ var i;
+ for (i in { a: 1, b: 2, c: 3 })
+ j = i, console.log(j);
+ var j;
+ })();
+ }
+ expect_stdout: [
+ "a",
+ "b",
+ "c",
+ ]
+}
+
+issue_2663_3: {
+ options = {
+ inline: true,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (function () {
+ var outputs = [
+ { type: 0, target: null, eventName: "ngSubmit", propName: null },
+ { type: 0, target: null, eventName: "submit", propName: null },
+ { type: 0, target: null, eventName: "reset", propName: null },
+ ];
+ function listenToElementOutputs(outputs) {
+ var handlers = [];
+ for (var i = 0; i < outputs.length; i++) {
+ var output = outputs[i];
+ var handleEventClosure = renderEventHandlerClosure(output.eventName);
+ handlers.push(handleEventClosure)
+ }
+ var target, name;
+ return handlers;
+ }
+ function renderEventHandlerClosure(eventName) {
+ return function () {
+ return console.log(eventName);
+ };
+ }
+ listenToElementOutputs(outputs).forEach(function (handler) {
+ return handler()
+ });
+ })();
+ }
+ expect: {
+ (function() {
+ function renderEventHandlerClosure(eventName) {
+ return function() {
+ return console.log(eventName);
+ };
+ }
+ (function(outputs) {
+ var handlers = [];
+ for (var i = 0; i < outputs.length; i++) {
+ var output = outputs[i];
+ var handleEventClosure = renderEventHandlerClosure(output.eventName);
+ handlers.push(handleEventClosure);
+ }
+ return handlers;
+ })([ {
+ type: 0,
+ target: null,
+ eventName: "ngSubmit",
+ propName: null
+ }, {
+ type: 0,
+ target: null,
+ eventName: "submit",
+ propName: null
+ }, {
+ type: 0,
+ target: null,
+ eventName: "reset",
+ propName: null
+ } ]).forEach(function(handler) {
+ return handler();
+ });
+ })();
+ }
+ expect_stdout: [
+ "ngSubmit",
+ "submit",
+ "reset",
+ ]
+}
rchslavonic, texlive-hyphen-coptic, texlive-hyphen-croatian, texlive-hyphen-czech, texlive-hyphen-danish, texlive-hyphen-dutch, texlive-hyphen-english, texlive-hyphen-esperanto, texlive-hyphen-estonian, texlive-hyphen-finnish, texlive-hyphen-french, texlive-hyphen-friulan, texlive-hyphen-galician, texlive-hyphen-georgian, texlive-hyphen-greek, texlive-hyphen-hungarian, texlive-hyphen-icelandic, texlive-hyphen-indic, texlive-hyphen-indonesian, texlive-hyphen-interlingua, texlive-hyphen-irish, texlive-hyphen-italian, texlive-hyphen-kurmanji, texlive-hyphen-latin, texlive-hyphen-latvian, texlive-hyphen-lithuanian, texlive-hyphen-mongolian, texlive-hyphen-norwegian, texlive-hyphen-occitan, texlive-hyphen-piedmontese, texlive-hyphen-polish, texlive-hyphen-portuguese, texlive-hyphen-romanian, texlive-hyphen-romansh, texlive-hyphen-russian, texlive-hyphen-sanskrit, texlive-hyphen-serbian, texlive-hyphen-slovak, texlive-hyphen-slovenian, texlive-hyphen-spanish, texlive-hyphen-swedish, texlive-hyphen-thai, texlive-hyphen-ukrainian, texlive-hyphen-uppersorbian, texlive-hyphen-welsh, texlive-hyph-utf8, texlive-dehyph-exptl, texlive-latex-kpathsea, texlive-latex-filecontents, texlive-latex-oberdisk, texlive-latex-tools, texlive-latex-l3kernel, texlive-latex-l3packages, texlive-latex-fontspec, texlive-latex-amsmath, texlive-latex-babel, texlive-generic-babel-german, texlive-latex-etoolbox, texlive-latex-g-brief, texlive-latex-geometry, texlive-latex-polyglossia, texlive-tex-texinfo, texlive-latex-colortbl, texlive-luatex-fancyhdr, texlive-latex-listings, texlive-latex-eso-pic, texlive-latex-enumitem, texlive-latex-multirow, texlive-latex-overpic, texlive-latex-parskip, texlive-latex-metapost, texlive-latex-acmart, texlive-fonts-media9, texlive-latex-ocgx2, texlive-latex-pgf, texlive-metapost, texlive-latex-koma-script, texlive-generic-listofitems, texlive-latex-bibtex, texlive-context-base, texlive-beamer, texlive-latex-pdfx, texlive-pstricks, texlive-tools, texlive-siunitx): Update hashes. Marius Bakke 2020-01-14gnu: Add texlive-hyphen-pali....* gnu/packages/tex.scm (texlive-hyphen-pali): New public variable. Marius Bakke 2020-01-14gnu: texlive-bin: Purge unused bundled software from the source....* gnu/packages/tex.scm (texlive-bin)[source](modules, snippet): New fields. Marius Bakke 2020-01-14gnu: texlive-bin: Do not build static libraries....* gnu/packages/tex.scm (texlive-bin)[arguments]: Add "--disable-static" in #:configure-flags. Marius Bakke 2020-01-14gnu: texlive-bin: Update to 20190410....* gnu/packages/patches/texlive-bin-CVE-2018-17407.patch, gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch: Delete files. * gnu/packages/patches/texlive-bin-poppler-0.83.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/tex.scm (texlive-extra-src): Update to 20190419. (texlive-bin): Likewise. [source](patches): Update Arch patches for Poppler 0.84 compatibility. [arguments]: Remove phase 'use-code-for-even-newer-poppler'; add phase 'patch-dvisgm-build-files'. Marius Bakke 2020-01-06Adjust module autoloads....In Guile < 2.9.7, autoloading a module would give you access to all its bindings. In future versions, autoloading a module gives access only to the listed bindings, as per #:select (see <https://bugs.gnu.org/38895>). This commit adjusts autoloads to the new semantics, allowing Guix to be built with Guile 2.9.7/2.9.8. * guix/build/download.scm <top level>: Remove call to 'module-autoload!'. (load-gnutls): New procedure. (tls-wrap): Call it. * guix/git.scm <top level>: Remove call to 'module-autoload!'. (load-git-submodules): New procedure. (update-submodules): Call it instead of 'resolve-interface'. * gnu/bootloader/grub.scm: Replace #:autoload with #:use-module. * gnu/packages.scm: Likewise. * gnu/packages/ssh.scm: Likewise. * gnu/packages/tex.scm: Likewise. * gnu/services/cuirass.scm: Likewise. * gnu/services/mcron.scm: Likewise. * guix/lint.scm: Augment list of bindings in #:autoload. * guix/scripts/build.scm: Likewise. * guix/scripts/gc.scm: Likewise. * guix/scripts/pack.scm: Likewise. * guix/scripts/publish.scm: Likewise. * guix/scripts/pull.scm: Likewise. * guix/utils.scm: Remove unnecessary #:autoload clauses; replace one of them with #:use-module. Ludovic Courtès