فهرست منبع

add test for #3683 (hope these tests won't become too much PITA when analyzer improves)

Dan Korostelev 10 سال پیش
والد
کامیت
6f8a28fe58
1فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 10 0
      tests/optimization/src/TestJs.hx

+ 10 - 0
tests/optimization/src/TestJs.hx

@@ -61,4 +61,14 @@ class TestJs {
 		inline function forEach(f) for (v in a) f(v);
 		forEach(function(x) trace(x + 2));
 	}
+
+	@:js('var a = "";var tmp;var __ex0 = a;var _g = __ex0.toLowerCase();switch(_g) {case "e":tmp = 0;break;default:throw false;}var e = tmp;')
+	@:analyzer(no_const_propagation, no_local_dce)
+	static function testRValueSwitchWithExtractors() {
+		var a = "";
+		var e = switch (a) {
+			case _.toLowerCase() => "e": 0;
+			default: throw false;
+		}
+	}
 }