From 5b4b07e9a7d67e593c6ae8d54dc77d174afd25ac Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sun, 5 Nov 2017 06:18:45 +0800 Subject: extend function inlining safety checks (#2430) --- test/compress/drop-unused.js | 55 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 11 deletions(-) (limited to 'test/compress/drop-unused.js') diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index 4ce8d2eb..af6a7a47 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -1109,11 +1109,11 @@ var_catch_toplevel: { } } -issue_2105: { +issue_2105_1: { options = { collapse_vars: true, inline: true, - passes: 3, + passes: 2, reduce_vars: true, side_effects: true, unused: true, @@ -1139,17 +1139,50 @@ issue_2105: { }); } expect: { - (function() { - var quux = function() { + ({ + prop: function() { + console.log; console.log("PASS"); - }; - return { - prop: function() { - console.log; - quux(); + } + }).prop(); + } + expect_stdout: "PASS" +} + +issue_2105_2: { + options = { + collapse_vars: true, + inline: true, + passes: 2, + properties: true, + pure_getters: "strict", + reduce_vars: true, + side_effects: true, + unsafe: true, + unused: true, + } + input: { + !function(factory) { + factory(); + }( function() { + return function(fn) { + fn()().prop(); + }( function() { + function bar() { + var quux = function() { + console.log("PASS"); + }, foo = function() { + console.log; + quux(); + }; + return { prop: foo }; } - }; - })().prop(); + return bar; + } ); + }); + } + expect: { + console.log("PASS"); } expect_stdout: "PASS" } -- cgit v1.2.3 ss='left'>Commit message (Expand)Author 2020-07-25Use 'formatted-message' instead of '&message' where appropriate....* gnu.scm (%try-use-modules): Use 'formatted-message' instead of '&message'. * gnu/machine/digital-ocean.scm (maybe-raise-unsupported-configuration-error): Likewise. * gnu/machine/ssh.scm (machine-check-file-system-availability): Likewise. (machine-check-building-for-appropriate-system): Likewise. (deploy-managed-host): Likewise. (maybe-raise-unsupported-configuration-error): Likewise. * gnu/packages.scm (search-patch): Likewise. * gnu/services.scm (%service-with-default-value): Likewise. (files->etc-directory): Likewise. (fold-services): Likewise. * gnu/system.scm (locale-name->definition*): Likewise. * gnu/system/mapped-devices.scm (check-device-initrd-modules): Likewise. (check-luks-device): Likewise. * guix/channels.scm (latest-channel-instance): Likewise. * guix/cve.scm (json->cve-items): Likewise. * guix/git-authenticate.scm (commit-signing-key): Likewise. (commit-authorized-keys): Likewise. (authenticate-commit): Likewise. (verify-introductory-commit): Likewise. * guix/remote.scm (remote-pipe-for-gexp): Likewise. * guix/scripts/graph.scm (assert-package): Likewise. * guix/scripts/offload.scm (private-key-from-file*): Likewise. * guix/ssh.scm (authenticate-server*): Likewise. (open-ssh-session): Likewise. (remote-inferior): Likewise. * guix/ui.scm (matching-generations): Likewise. * guix/upstream.scm (package-update): Likewise. * tests/channels.scm ("latest-channel-instances, missing introduction for 'guix'"): Catch 'formatted-message?'. ("authenticate-channel, wrong first commit signer"): Likewise. * tests/lint.scm ("patches: not found"): Adjust message string. * tests/packages.scm ("patch not found yields a run-time error"): Catch 'formatted-message?'. * guix/lint.scm (check-patch-file-names): Handle 'formatted-message?'. (check-derivation): Ditto. Ludovic Courtès 2020-07-25utils: Move '&fix-hint' to (guix diagnostics)....* guix/utils.scm (&fix-hint): Move to... * guix/diagnostics.scm (&fix-hint): ... here. * gnu.scm: Adjust imports accordingly. * gnu/system/mapped-devices.scm: Likewise. * guix/channels.scm: Likewise. * guix/profiles.scm: Likewise. * guix/scripts/system/reconfigure.scm: Likewise. * guix/ssh.scm: Likewise. Ludovic Courtès 2020-07-25utils: Move <location> and '&error-location' to (guix diagnostics)....* guix/utils.scm (<location>, source-properties->location) (location->source-properties, &error-location): Move to... * guix/diagnostics.scm: ... here. * gnu.scm: Adjust imports accordingly. * gnu/machine.scm: Likewise. * gnu/system.scm: Likewise. * gnu/tests.scm: Likewise. * guix/inferior.scm: Likewise. * tests/channels.scm: Likewise. * tests/packages.scm: Likewise. Ludovic Courtès