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

Unified Diff: node_modules/vulcanize/node_modules/uglify-js/test/compress/labels.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/labels.js
diff --git a/node_modules/vulcanize/node_modules/uglify-js/test/compress/labels.js b/node_modules/vulcanize/node_modules/uglify-js/test/compress/labels.js
new file mode 100644
index 0000000000000000000000000000000000000000..044b7a7eabc8a1af55a40ae6a1bc2403aabce766
--- /dev/null
+++ b/node_modules/vulcanize/node_modules/uglify-js/test/compress/labels.js
@@ -0,0 +1,163 @@
+labels_1: {
+ options = { if_return: true, conditionals: true, dead_code: true };
+ input: {
+ out: {
+ if (foo) break out;
+ console.log("bar");
+ }
+ };
+ expect: {
+ foo || console.log("bar");
+ }
+}
+
+labels_2: {
+ options = { if_return: true, conditionals: true, dead_code: true };
+ input: {
+ out: {
+ if (foo) print("stuff");
+ else break out;
+ console.log("here");
+ }
+ };
+ expect: {
+ if (foo) {
+ print("stuff");
+ console.log("here");
+ }
+ }
+}
+
+labels_3: {
+ options = { if_return: true, conditionals: true, dead_code: true };
+ input: {
+ for (var i = 0; i < 5; ++i) {
+ if (i < 3) continue;
+ console.log(i);
+ }
+ };
+ expect: {
+ for (var i = 0; i < 5; ++i)
+ i < 3 || console.log(i);
+ }
+}
+
+labels_4: {
+ options = { if_return: true, conditionals: true, dead_code: true };
+ input: {
+ out: for (var i = 0; i < 5; ++i) {
+ if (i < 3) continue out;
+ console.log(i);
+ }
+ };
+ expect: {
+ for (var i = 0; i < 5; ++i)
+ i < 3 || console.log(i);
+ }
+}
+
+labels_5: {
+ options = { if_return: true, conditionals: true, dead_code: true };
+ // should keep the break-s in the following
+ input: {
+ while (foo) {
+ if (bar) break;
+ console.log("foo");
+ }
+ out: while (foo) {
+ if (bar) break out;
+ console.log("foo");
+ }
+ };
+ expect: {
+ while (foo) {
+ if (bar) break;
+ console.log("foo");
+ }
+ out: while (foo) {
+ if (bar) break out;
+ console.log("foo");
+ }
+ }
+}
+
+labels_6: {
+ input: {
+ out: break out;
+ };
+ expect: {}
+}
+
+labels_7: {
+ options = { if_return: true, conditionals: true, dead_code: true };
+ input: {
+ while (foo) {
+ x();
+ y();
+ continue;
+ }
+ };
+ expect: {
+ while (foo) {
+ x();
+ y();
+ }
+ }
+}
+
+labels_8: {
+ options = { if_return: true, conditionals: true, dead_code: true };
+ input: {
+ while (foo) {
+ x();
+ y();
+ break;
+ }
+ };
+ expect: {
+ while (foo) {
+ x();
+ y();
+ break;
+ }
+ }
+}
+
+labels_9: {
+ options = { if_return: true, conditionals: true, dead_code: true };
+ input: {
+ out: while (foo) {
+ x();
+ y();
+ continue out;
+ z();
+ k();
+ }
+ };
+ expect: {
+ while (foo) {
+ x();
+ y();
+ }
+ }
+}
+
+labels_10: {
+ options = { if_return: true, conditionals: true, dead_code: true };
+ input: {
+ out: while (foo) {
+ x();
+ y();
+ break out;
+ z();
+ k();
+ }
+ };
+ expect: {
+ out: while (foo) {
+ x();
+ y();
+ break out;
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698