* [cs] Fix cs.Lib.unsafe * Use bin for output instead of cs
@@ -1409,8 +1409,11 @@ let generate con =
expr_s w e;
write w "]"
| TCall ({ eexpr = TIdent "__unsafe__" }, [ e ] ) ->
- write w "unsafe";
- expr_s w (mk_block e)
+ write w "unsafe ";
+ begin_block w;
+ expr_s w (mk_block e);
+ write w ";";
+ end_block w
| TCall ({ eexpr = TIdent "__checked__" }, [ e ] ) ->
write w "checked";
expr_s w (mk_block e)
@@ -0,0 +1,22 @@
+class Main {
+ public static function main() {
+ var x:cs.NativeArray<Int> = new cs.NativeArray(1);
+
+ cs.Lib.unsafe({trace(42);});
+ cs.Lib.unsafe(trace(42));
+ cs.Lib.unsafe({
+ cs.Lib.fixed({
+ var addr = cs.Lib.pointerOfArray(x);
+ trace(cs.Lib.valueOf(addr)); //0
+ addr[0] = 42;
+ trace(cs.Lib.valueOf(addr)); //42
+ });
+ }
+ @:unsafe static function unsafeFunction() {}
+}
+@:unsafe
+class TestUnsafe {}
@@ -0,0 +1,3 @@
+-cs bin
+-D unsafe
+-main Main