소스 검색

add test for inlining with complex expr (see #2338)

Dan Korostelev 10 년 전
부모
커밋
76e3aa4044
1개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 11 1
      tests/optimization/src/TestJs.hx

+ 11 - 1
tests/optimization/src/TestJs.hx

@@ -30,4 +30,14 @@ class TestJs {
         var v2 = v;
         return v + v2;
     }
-}
+
+    @:js("var a = [];var tmp;try {tmp = a[0];} catch( e ) {tmp = null;}if(tmp) {}")
+    static function testInlineWithComplexExpr() {
+        var a = [];
+        if (_inlineWithComplexExpr(a, 0)) {}
+    }
+
+    inline static function _inlineWithComplexExpr(a, i) {
+    	return try a[i] catch (e:Dynamic) null;
+    }
+}