зеркало из https://github.com/mozilla/pjs.git
Changing Refrence.set(Object) to return Object to return the real stored value.
This commit is contained in:
Родитель
4db86ff03e
Коммит
a5438d7003
|
@ -2513,8 +2513,7 @@ switch (op) {
|
|||
--stackTop;
|
||||
Object lhs = stack[stackTop];
|
||||
if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]);
|
||||
ScriptRuntime.setReference(lhs, rhs);
|
||||
stack[stackTop] = rhs;
|
||||
stack[stackTop] = ScriptRuntime.setReference(lhs, rhs);
|
||||
continue Loop;
|
||||
}
|
||||
case Icode_REF_INC_DEC : {
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class Reference
|
|||
{
|
||||
public abstract Object get();
|
||||
|
||||
public abstract void set(Object value);
|
||||
public abstract Object set(Object value);
|
||||
|
||||
public void delete()
|
||||
{
|
||||
|
|
|
@ -1265,7 +1265,7 @@ public class ScriptRuntime {
|
|||
return ref.get();
|
||||
}
|
||||
|
||||
public static void setReference(Object obj, Object value)
|
||||
public static Object setReference(Object obj, Object value)
|
||||
{
|
||||
if (!(obj instanceof Reference)) {
|
||||
String msg = getMessage2("msg.no.ref.to.set",
|
||||
|
@ -1273,7 +1273,7 @@ public class ScriptRuntime {
|
|||
throw constructError("ReferenceError", msg);
|
||||
}
|
||||
Reference ref = (Reference)obj;
|
||||
ref.set(value);
|
||||
return ref.set(value);
|
||||
}
|
||||
|
||||
static boolean isSpecialProperty(String s)
|
||||
|
@ -1306,12 +1306,12 @@ public class ScriptRuntime {
|
|||
}
|
||||
}
|
||||
|
||||
public void set(Object value)
|
||||
public Object set(Object value)
|
||||
{
|
||||
if (id == PROTO) {
|
||||
setProto(obj, value, scope);
|
||||
return setProto(obj, value, scope);
|
||||
} else {
|
||||
setParent(obj, value, scope);
|
||||
return setParent(obj, value, scope);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3486,11 +3486,9 @@ class BodyCodegen
|
|||
"getReference", "(Ljava/lang/Object;)Ljava/lang/Object;");
|
||||
}
|
||||
generateCodeFromNode(child, node);
|
||||
cfw.add(ByteCode.DUP_X1);
|
||||
// stack: value ref value
|
||||
addScriptRuntimeInvoke(
|
||||
"setReference", "(Ljava/lang/Object;Ljava/lang/Object;)V");
|
||||
// stack: value
|
||||
"setReference",
|
||||
"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
||||
}
|
||||
|
||||
private void visitBind(Node node, Node child)
|
||||
|
|
Загрузка…
Ссылка в новой задаче