Browse Source

test generation of deep switches when used as a value

Dan Korostelev 10 năm trước cách đây
mục cha
commit
760ed52bb3
1 tập tin đã thay đổi với 10 bổ sung0 xóa
  1. 10 0
      tests/optimization/src/TestJs.hx

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

@@ -41,4 +41,14 @@ class TestJs {
 		return try a[i] catch (e:Dynamic) null;
 	}
 
+	@:js("var a = { v : [{ b : 1}]};a;var tmp;switch(a.v.length) {case 1:switch(a.v[0].b) {case 1:tmp = true;break;default:tmp = false;}break;default:tmp = false;}if(tmp) {}")
+	@:analyzer(no_const_propagation)
+	static function testDeepMatchingWithoutClosures() {
+		var a = {v: [{b: 1}]};
+		a;
+		if (switch (a) {
+			case {v: [{b: 1}]}: true;
+			default: false;
+		}) {}
+	}
 }