Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: node_modules/vulcanize/node_modules/uglify-js/test/compress/drop-unused.js

Issue 800513006: Added vulcanize under third_party/npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: node_modules/vulcanize/node_modules/uglify-js/test/compress/drop-unused.js
diff --git a/node_modules/vulcanize/node_modules/uglify-js/test/compress/drop-unused.js b/node_modules/vulcanize/node_modules/uglify-js/test/compress/drop-unused.js
new file mode 100644
index 0000000000000000000000000000000000000000..89bf0088fac75c1e55823b8366dc0628f67f55c2
--- /dev/null
+++ b/node_modules/vulcanize/node_modules/uglify-js/test/compress/drop-unused.js
@@ -0,0 +1,165 @@
+unused_funarg_1: {
+ options = { unused: true };
+ input: {
+ function f(a, b, c, d, e) {
+ return a + b;
+ }
+ }
+ expect: {
+ function f(a, b) {
+ return a + b;
+ }
+ }
+}
+
+unused_funarg_2: {
+ options = { unused: true };
+ input: {
+ function f(a, b, c, d, e) {
+ return a + c;
+ }
+ }
+ expect: {
+ function f(a, b, c) {
+ return a + c;
+ }
+ }
+}
+
+unused_nested_function: {
+ options = { unused: true };
+ input: {
+ function f(x, y) {
+ function g() {
+ something();
+ }
+ return x + y;
+ }
+ };
+ expect: {
+ function f(x, y) {
+ return x + y;
+ }
+ }
+}
+
+unused_circular_references_1: {
+ options = { unused: true };
+ input: {
+ function f(x, y) {
+ // circular reference
+ function g() {
+ return h();
+ }
+ function h() {
+ return g();
+ }
+ return x + y;
+ }
+ };
+ expect: {
+ function f(x, y) {
+ return x + y;
+ }
+ }
+}
+
+unused_circular_references_2: {
+ options = { unused: true };
+ input: {
+ function f(x, y) {
+ var foo = 1, bar = baz, baz = foo + bar, qwe = moo();
+ return x + y;
+ }
+ };
+ expect: {
+ function f(x, y) {
+ moo(); // keeps side effect
+ return x + y;
+ }
+ }
+}
+
+unused_circular_references_3: {
+ options = { unused: true };
+ input: {
+ function f(x, y) {
+ var g = function() { return h() };
+ var h = function() { return g() };
+ return x + y;
+ }
+ };
+ expect: {
+ function f(x, y) {
+ return x + y;
+ }
+ }
+}
+
+unused_keep_setter_arg: {
+ options = { unused: true };
+ input: {
+ var x = {
+ _foo: null,
+ set foo(val) {
+ },
+ get foo() {
+ return this._foo;
+ }
+ }
+ }
+ expect: {
+ var x = {
+ _foo: null,
+ set foo(val) {
+ },
+ get foo() {
+ return this._foo;
+ }
+ }
+ }
+}
+
+unused_var_in_catch: {
+ options = { unused: true };
+ input: {
+ function foo() {
+ try {
+ foo();
+ } catch(ex) {
+ var x = 10;
+ }
+ }
+ }
+ expect: {
+ function foo() {
+ try {
+ foo();
+ } catch(ex) {}
+ }
+ }
+}
+
+used_var_in_catch: {
+ options = { unused: true };
+ input: {
+ function foo() {
+ try {
+ foo();
+ } catch(ex) {
+ var x = 10;
+ }
+ return x;
+ }
+ }
+ expect: {
+ function foo() {
+ try {
+ foo();
+ } catch(ex) {
+ var x = 10;
+ }
+ return x;
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698