Browse Source

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

Dan Korostelev 10 years ago
parent
commit
76e3aa4044
1 changed files with 11 additions and 1 deletions
  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;
+    }
+}