rt/emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/lang/System.java
changeset 1958 aa2e9630b6d5
parent 1940 e568ae8ef9af
     1.1 --- a/rt/emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/lang/System.java	Tue Apr 26 07:59:10 2016 +0200
     1.2 +++ b/rt/emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/lang/System.java	Thu Apr 28 07:13:00 2016 +0200
     1.3 @@ -84,15 +84,17 @@
     1.4          public void close() throws IOException {
     1.5          }
     1.6      };
     1.7 +    @JavaScriptBody(args = { "fn", "p" }, body = "return fn(p);")
     1.8 +    private static native Object invoke(Object fn, Object p);
     1.9      
    1.10      @Exported
    1.11 -    private static Object convArray(Object o) {
    1.12 +    private static Object convArray(Object o, Object convToJS) {
    1.13          if (o instanceof Object[]) {
    1.14              Object[] arr = (Object[]) o;
    1.15              final int l = arr.length;
    1.16              Object[] ret = new Object[l];
    1.17              for (int i = 0; i < l; i++) {
    1.18 -                ret[i] = convArray(arr[i]);
    1.19 +                ret[i] = invoke(convToJS, arr[i]);
    1.20              }
    1.21              return ret;
    1.22          }