public virtual void execute2(RunTimeValueBase thisObj, rtti.FunctionDefine functionDefine, SLOT[] argements, SLOT returnSlot, SourceToken token, object stackframe, out bool success) { throw new NotImplementedException(); }
public virtual void executeAsync(RunTimeValueBase thisObj,SLOT[] argements,SLOT resultSlot, object callbacker,object stackframe, SourceToken token,RunTimeScope scope) { }
public static void execAssigning(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { ASBinCode.SLOT slot = step.reg.getSlotForAssign(scope,frame); ASBinCode.RunTimeValueBase v = step.arg1.getValue(scope,frame); bool success; var lt = slot.assign(v,out success); if (!success) //(!slot.directSet(v)) { if (!(slot is StackSlot)) //直接赋值时 { //ext = "Illegal assignment to function " + ((MethodGetterBase)step.reg).name + "."; } else { StackSlot oslot = (StackSlot)slot; //if (oslot.linktarget != null) { //slot = oslot.linktarget; slot = lt; } if (step.arg1 is IMemReg) { //将其暂存到临时槽内 frame._tempSlot2.directSet(v); v = frame._tempSlot2.getValue(); } if (slot is SetThisItemSlot) { _doSetThisItem(((SetThisItemSlot)slot).bindObj,v,((SetThisItemSlot)slot).setindex,oslot,frame,step); return; } if (slot is ClassPropertyGetter.PropertySlot) { ClassPropertyGetter.PropertySlot propslot = (ASBinCode.ClassPropertyGetter.PropertySlot)slot; //***调用访问器。*** ASBinCode.ClassPropertyGetter prop = oslot.stackObjects.propGetSet; //propslot.property; _doPropAssigning(prop,frame,step,frame.player,scope, //propslot.bindObj oslot.stackObjects.propBindObj ,v, oslot ); return; } if (slot is OpVector.vectorSLot) //Vector类型不匹配 { BlockCallBackBase cb = frame.player.blockCallBackPool.create(); cb.scope = scope; cb.step = step; cb.args = frame; cb.setCallBacker(_vectorConvertCallBacker); cb.cacheObjects[0] = slot; //***调用强制类型转换*** OpCast.CastValue(v,((OpVector.vectorSLot)slot).vector_data.vector_type, frame,step.token,scope,frame._tempSlot1,cb,false); return; } if (slot is ObjectMemberSlot && !((ObjectMemberSlot)slot).isConstMember) { BlockCallBackBase cb = frame.player.blockCallBackPool.create(); cb.scope = scope; cb.step = step; cb.args = frame; cb.setCallBacker(_objectmemberslotConvertCallbacker); cb.cacheObjects[0] = slot; //***调用强制类型转换*** OpCast.CastValue(v,((ObjectMemberSlot)slot).slottype, frame,step.token,scope,frame._tempSlot1,cb,false); return; } } string ext = String.Empty; if (slot is MethodGetterBase.MethodSlot) { ext = "Cannot assign to a method "; // + ((ASBinCode.ClassMethodGetter.MethodSlot)slot).method; } else if (slot is ObjectMemberSlot) { ext = "Illegal write to read-only property "; //+ ((ObjectMemberSlot)slot).obj.value._class.name //+" on ppp.PPC." } else if (slot is ClassPropertyGetter.PropertySlot) { ext = "Illegal write to read-only property "; } else if (slot is OpAccess_Dot.prototypeSlot) { ext = "Cannot create property " + ((OpAccess_Dot.prototypeSlot)slot)._protoname + " on " + ((OpAccess_Dot.prototypeSlot)slot)._protoRootObj.value._class.name; } frame.throwError( step.token,0,ext ); frame.endStep(step); } else { frame.endStepNoError(); } }
public static void exec_try_read_prop(StackFrame frame, OpStep step, RunTimeScope scope) { ASBinCode.SLOT slot = ((StackSlotAccessor)step.arg1).getSlot(scope,frame); if (slot.isPropGetterSetter) { ((StackSlot)slot).linkTo(null); _do_prop_read( ((StackSlot)slot).stackObjects.propGetSet, frame,step,frame.player,scope,((StackSlot)slot).stackObjects.propBindObj,((StackSlot)slot).stackObjects.superPropBindClass ); } else if (slot.isSetThisItem) { SetThisItemSlot sslot = (SetThisItemSlot)((StackSlot)slot).getLinkSlot(); ((StackSlot)slot).linkTo(null); //***调用索引器get*** RunTimeValueBase func; var rtObj = sslot.bindObj; var player = frame.player; var v2 = sslot.setindex; func = ((MethodGetterBase)sslot.get_this_item.bindField).getMethod( rtObj ); var funCaller = player.funcCallerPool.create(frame,step.token); funCaller.SetFunction((ASBinCode.rtData.rtFunction)func); ((ASBinCode.rtData.rtFunction)func).Clear(); funCaller.loadDefineFromFunction(); if (!funCaller.createParaScope()) { return; } //funCaller.releaseAfterCall = true; bool success; funCaller.pushParameter(v2,0,out success); if (!success) { frame.endStep(step); return; } funCaller._tempSlot = frame._tempSlot1; funCaller.returnSlot = step.reg.getSlot(scope,frame); StackSlot ret = (StackSlot)funCaller.returnSlot; ret.stackObjects._temp_try_write_setthisitem = ret._cache_setthisslot; ret.refPropChanged = true; ret._cache_setthisslot.bindObj = rtObj; ret._cache_setthisslot.setindex = v2; ret._cache_setthisslot.set_this_item = sslot.set_this_item; BlockCallBackBase cb = frame.player.blockCallBackPool.create(); cb.setCallBacker(D_get_this_item_callbacker); cb.step = step; cb.args = frame; funCaller.callbacker = cb; funCaller.call(); return; } else { SLOT regslot = step.reg.getSlot(scope,frame); StackSlot d = regslot as StackSlot; StackSlot s = slot as StackSlot; if (d != null && s != null && s.getLinkSlot() != null) { d.linkTo(s.getLinkSlot()); s.linkTo(null); } else { regslot.directSet(slot.getValue()); } //frame.endStep(step); frame.endStepNoError(); } }