Skip to content

Commit 403d2cd

Browse files
committed
Use Object.create() instead of our own polyfill
1 parent 7b221c1 commit 403d2cd

File tree

1 file changed

+8
-11
lines changed
  • dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang

1 file changed

+8
-11
lines changed

dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Runtime.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,20 @@ public static native void defineClass(JavaScriptObject typeId,
7777
}
7878
}-*/;
7979

80-
private static native JavaScriptObject portableObjCreate(JavaScriptObject obj) /*-{
81-
function F() {};
82-
F.prototype = obj || {};
83-
return new F();
84-
}-*/;
85-
8680
/**
8781
* Create a subclass prototype.
8882
*/
8983
private static native JavaScriptObject createSubclassPrototype(
9084
JavaScriptObject superTypeIdOrPrototype) /*-{
91-
var superPrototype = superTypeIdOrPrototype && superTypeIdOrPrototype.prototype;
92-
if (!superPrototype) {
93-
// If it is not a prototype, then it should be a type id.
94-
superPrototype = @Runtime::prototypesByTypeId[superTypeIdOrPrototype];
85+
var superPrototype = null;
86+
if (superTypeIdOrPrototype != null) {
87+
superPrototype = superTypeIdOrPrototype && superTypeIdOrPrototype.prototype;
88+
if (!superPrototype) {
89+
// If it is not a prototype, then it should be a type id.
90+
superPrototype = @Runtime::prototypesByTypeId[superTypeIdOrPrototype];
91+
}
9592
}
96-
return @Runtime::portableObjCreate(*)(superPrototype);
93+
return Object.create(superPrototype);
9794
}-*/;
9895

9996
public static native void copyObjectProperties(JavaScriptObject from, JavaScriptObject to) /*-{

0 commit comments

Comments
 (0)