浏览代码

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;
+    }
+}