I wanted to provide a patch for JsArray* to support common methods
like sort and reverse. I found the issue
http://code.google.com/p/google-web-toolkit/issues/detail?id=2793
which is not completed and wants to provide all ECMA methods.

I had a look at the existing patch and found code that I didn't
understand and which indicates that I miss some knowledge before being
able to write a proper patch. Why is the following code checking for
script/binary mode and calling different methods?

Best Regards

Sebastian

+  public final native int push(T item) /*-{
+    return this.push(items);
+  }-*/;
+
+  public final int push(T... items) {
+    if (GWT.isScript()) {
+      return push0(items);
+    } else {
+      for (T item : items) {
+        push(item);
+      }
+      return length();
+    }
+  };
+
+  private native int push0(T[] items) /*-{
+    return this.push.apply(this, items);
+  }-*/;

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to