зеркало из https://github.com/mozilla/pjs.git
LC3 support: make Java arrays have Array.prototype as a prototype.
This commit is contained in:
Родитель
31a7740439
Коммит
45e66dd4d3
|
@ -52,6 +52,21 @@ public class NativeJavaArray extends NativeJavaObject {
|
|||
this.array = array;
|
||||
this.length = Array.getLength(array);
|
||||
this.cls = cl.getComponentType();
|
||||
setPrototype(ScriptableObject.getClassPrototype(scope, "Array"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the prototype of the object.
|
||||
*/
|
||||
public Scriptable getPrototype() {
|
||||
return prototype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the prototype of the object.
|
||||
*/
|
||||
public void setPrototype(Scriptable m) {
|
||||
prototype = m;
|
||||
}
|
||||
|
||||
public boolean has(String id, Scriptable start) {
|
||||
|
@ -118,4 +133,5 @@ public class NativeJavaArray extends NativeJavaObject {
|
|||
Object array;
|
||||
int length;
|
||||
Class cls;
|
||||
Scriptable prototype;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,21 @@ public class NativeJavaArray extends NativeJavaObject {
|
|||
this.array = array;
|
||||
this.length = Array.getLength(array);
|
||||
this.cls = cl.getComponentType();
|
||||
setPrototype(ScriptableObject.getClassPrototype(scope, "Array"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the prototype of the object.
|
||||
*/
|
||||
public Scriptable getPrototype() {
|
||||
return prototype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the prototype of the object.
|
||||
*/
|
||||
public void setPrototype(Scriptable m) {
|
||||
prototype = m;
|
||||
}
|
||||
|
||||
public boolean has(String id, Scriptable start) {
|
||||
|
@ -118,4 +133,5 @@ public class NativeJavaArray extends NativeJavaObject {
|
|||
Object array;
|
||||
int length;
|
||||
Class cls;
|
||||
Scriptable prototype;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче