public static void exec_delete(StackFrame frame, OpStep step, RunTimeScope scope) { { StackSlot slot = (StackSlot)((StackSlotAccessor)step.arg1).getSlot(scope, frame); var ls = slot.getLinkSlot(); if (ls is DynamicPropertySlot) { DynamicPropertySlot link = (DynamicPropertySlot)ls; if (link._canDelete) { ((ASBinCode.rtti.DynamicObject)link.obj.value).deleteProperty(link._propname); } else { if (link.backup != null) { link.directSet(link.backup); } } } else if (ls is DictionarySlot) { DictionarySlot link = (DictionarySlot)ls; ((ASBinCode.rtti.DictionaryObject)link.obj.value).RemoveKey(link._key); } else if (ls is OpAccess_Dot.arraySlot) //(slot.fromArray != null) { //slot.directSet(rtUndefined.undefined); //bool success; //slot.assign(rtUndefined.undefined,out success); ((OpAccess_Dot.arraySlot)ls).delete(); //slot.fromArray.innerArray[slot.fromArrayIndex] = rtUndefined.undefined; } else if (ls is OpAccess_Dot.prototypeSlot) { //原型链对象,不可删除 } else if (ls is OpVector.vectorSLot) { //数组链接,跳过 } else { frame.throwError( step.token, 0, "动态属性才能被delete" ); } slot.linkTo(null); frame.endStep(step); } }
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(); } }