[gwt-rpc-plus] r153 committed - Use Java code for iteration in lists to give the GWT inliner a chance.

2 views
Skip to first unread message

gwt-rp...@googlecode.com

unread,
Apr 8, 2010, 6:56:01 PM4/8/10
to dotspots-o...@googlegroups.com
Revision: 153
Author: mmastrac
Date: Thu Apr 8 15:55:27 2010
Log: Use Java code for iteration in lists to give the GWT inliner a chance.
http://code.google.com/p/gwt-rpc-plus/source/detail?r=153

Modified:

/trunk/gwt-rpc-plus/codegen/com/dotspots/rpcplus/codegen/jscollections/CollectionGen.java

/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcList.java

/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListBool.java

/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListDouble.java

/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListInt.java

/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListString.java

=======================================
---
/trunk/gwt-rpc-plus/codegen/com/dotspots/rpcplus/codegen/jscollections/CollectionGen.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/codegen/com/dotspots/rpcplus/codegen/jscollections/CollectionGen.java
Thu Apr 8 15:55:27 2010
@@ -238,22 +238,19 @@
printWriter.println();
// TODO: long
if (value != long.class) {
- printWriter.println(" public native boolean forEach(" +
getProcedureName(value, true) + " procedure) /*-{");
- printWriter.println(" for (var i = 0; i < this.length; i++)
{ ");
- printWriter.println(" if (!procedure.@" + packageName
+ "." + getProcedureName(value, false) + "::execute("
- + valueBinaryName + ")(this[i])) return false;");
+ printWriter.println(" public boolean forEach(" +
getProcedureName(value, true) + " procedure) {");
+ printWriter.println(" for (int i = 0; i < size(); i++) { ");
+ printWriter.println(" if (!procedure.execute(get(i)))
return false;");
printWriter.println(" }");
printWriter.println(" return true;");
- printWriter.println(" }-*/;");
+ printWriter.println(" };");
printWriter.println();
- printWriter.println(" public native boolean forEach(" +
getProcedureName(int.class, value, true)
- + " procedure) /*-{");
- printWriter.println(" for (var i = 0; i < this.length; i++)
{ ");
- printWriter.println(" if (!procedure.@" + packageName
+ "." + getProcedureName(int.class, value, false)
- + "::execute(I" + valueBinaryName + ")(i, this[i])) return false;");
+ printWriter.println(" public boolean forEach(" +
getProcedureName(int.class, value, true) + " procedure) {");
+ printWriter.println(" for (int i = 0; i < size(); i++) { ");
+ printWriter.println(" if (!procedure.execute(i, get(i)))
return false;");
printWriter.println(" }");
printWriter.println(" return true;");
- printWriter.println(" }-*/;");
+ printWriter.println(" };");
printWriter.println();
}
} else {
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcList.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcList.java
Thu Apr 8 15:55:27 2010
@@ -30,19 +30,19 @@
this.splice(idx, 1);
}-*/;

- public native boolean forEach(JsRpcObjectProcedure<E> procedure) /*-{
- for (var i = 0; i < this.length; i++) {
- if
(!procedure.@com.dotspots.rpcplus.client.jscollections.JsRpcObjectProcedure::execute(Ljava/lang/Object;)(this[i]))
return false;
+ public boolean forEach(JsRpcObjectProcedure<E> procedure) {
+ for (int i = 0; i < size(); i++) {
+ if (!procedure.execute(get(i))) return false;
}
return true;
- }-*/;
-
- public native boolean forEach(JsRpcIntObjectProcedure<E> procedure)
/*-{
- for (var i = 0; i < this.length; i++) {
- if
(!procedure.@com.dotspots.rpcplus.client.jscollections.JsRpcIntObjectProcedure::execute(ILjava/lang/Object;)(i,
this[i])) return false;
+ };
+
+ public boolean forEach(JsRpcIntObjectProcedure<E> procedure) {
+ for (int i = 0; i < size(); i++) {
+ if (!procedure.execute(i, get(i))) return false;
}
return true;
- }-*/;
+ };

public native E get(int idx) /*-{
return this[idx] || null;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListBool.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListBool.java
Thu Apr 8 15:55:27 2010
@@ -30,19 +30,19 @@
this.splice(idx, 1);
}-*/;

- public native boolean forEach(JsRpcBoolProcedure procedure) /*-{
- for (var i = 0; i < this.length; i++) {
- if
(!procedure.@com.dotspots.rpcplus.client.jscollections.JsRpcBoolProcedure::execute(Z)(this[i]))
return false;
+ public boolean forEach(JsRpcBoolProcedure procedure) {
+ for (int i = 0; i < size(); i++) {
+ if (!procedure.execute(get(i))) return false;
}
return true;
- }-*/;
-
- public native boolean forEach(JsRpcIntBoolProcedure procedure) /*-{
- for (var i = 0; i < this.length; i++) {
- if
(!procedure.@com.dotspots.rpcplus.client.jscollections.JsRpcIntBoolProcedure::execute(IZ)(i,
this[i])) return false;
+ };
+
+ public boolean forEach(JsRpcIntBoolProcedure procedure) {
+ for (int i = 0; i < size(); i++) {
+ if (!procedure.execute(i, get(i))) return false;
}
return true;
- }-*/;
+ };

public native boolean get(int idx) /*-{
// Coerce to boolean in case underlying value is integer
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListDouble.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListDouble.java
Thu Apr 8 15:55:27 2010
@@ -30,19 +30,19 @@
this.splice(idx, 1);
}-*/;

- public native boolean forEach(JsRpcDoubleProcedure procedure) /*-{
- for (var i = 0; i < this.length; i++) {
- if
(!procedure.@com.dotspots.rpcplus.client.jscollections.JsRpcDoubleProcedure::execute(D)(this[i]))
return false;
+ public boolean forEach(JsRpcDoubleProcedure procedure) {
+ for (int i = 0; i < size(); i++) {
+ if (!procedure.execute(get(i))) return false;
}
return true;
- }-*/;
-
- public native boolean forEach(JsRpcIntDoubleProcedure procedure) /*-{
- for (var i = 0; i < this.length; i++) {
- if
(!procedure.@com.dotspots.rpcplus.client.jscollections.JsRpcIntDoubleProcedure::execute(ID)(i,
this[i])) return false;
+ };
+
+ public boolean forEach(JsRpcIntDoubleProcedure procedure) {
+ for (int i = 0; i < size(); i++) {
+ if (!procedure.execute(i, get(i))) return false;
}
return true;
- }-*/;
+ };

public native double get(int idx) /*-{
return this[idx] || 0;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListInt.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListInt.java
Thu Apr 8 15:55:27 2010
@@ -30,19 +30,19 @@
this.splice(idx, 1);
}-*/;

- public native boolean forEach(JsRpcIntProcedure procedure) /*-{
- for (var i = 0; i < this.length; i++) {
- if
(!procedure.@com.dotspots.rpcplus.client.jscollections.JsRpcIntProcedure::execute(I)(this[i]))
return false;
+ public boolean forEach(JsRpcIntProcedure procedure) {
+ for (int i = 0; i < size(); i++) {
+ if (!procedure.execute(get(i))) return false;
}
return true;
- }-*/;
-
- public native boolean forEach(JsRpcIntIntProcedure procedure) /*-{
- for (var i = 0; i < this.length; i++) {
- if
(!procedure.@com.dotspots.rpcplus.client.jscollections.JsRpcIntIntProcedure::execute(II)(i,
this[i])) return false;
+ };
+
+ public boolean forEach(JsRpcIntIntProcedure procedure) {
+ for (int i = 0; i < size(); i++) {
+ if (!procedure.execute(i, get(i))) return false;
}
return true;
- }-*/;
+ };

public native int get(int idx) /*-{
return this[idx] || 0;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListString.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListString.java
Thu Apr 8 15:55:27 2010
@@ -30,19 +30,19 @@
this.splice(idx, 1);
}-*/;

- public native boolean forEach(JsRpcStringProcedure procedure) /*-{
- for (var i = 0; i < this.length; i++) {
- if
(!procedure.@com.dotspots.rpcplus.client.jscollections.JsRpcStringProcedure::execute(Ljava/lang/String;)(this[i]))
return false;
+ public boolean forEach(JsRpcStringProcedure procedure) {
+ for (int i = 0; i < size(); i++) {
+ if (!procedure.execute(get(i))) return false;
}
return true;
- }-*/;
-
- public native boolean forEach(JsRpcIntStringProcedure procedure) /*-{
- for (var i = 0; i < this.length; i++) {
- if
(!procedure.@com.dotspots.rpcplus.client.jscollections.JsRpcIntStringProcedure::execute(ILjava/lang/String;)(i,
this[i])) return false;
+ };
+
+ public boolean forEach(JsRpcIntStringProcedure procedure) {
+ for (int i = 0; i < size(); i++) {
+ if (!procedure.execute(i, get(i))) return false;
}
return true;
- }-*/;
+ };

public native String get(int idx) /*-{
return this[idx] || null;


--
Subscription settings: http://groups.google.com/group/dotspots-open-source/subscribe?hl=en
Reply all
Reply to author
Forward
0 new messages