public void pushParameter_Para(RunTimeValueBase argement,int id,out bool success) { if (doPushNativeModeConstParameter(argement,id,out success)) { return; } //***最后一个是参数数组,并且id大于等于最后一个 SLOT slot = _getArgementSlot(toCallFunc.signature.parameters.Count - 1); //CallFuncHeap[toCallFunc.signature.parameters.Count - 1]; if (slot.getValue().rtType == RunTimeDataType.rt_null) { slot.directSet(new ASBinCode.rtData.rtArray()); } ASBinCode.rtData.rtArray arr = (ASBinCode.rtData.rtArray)slot.getValue(); arr.innerArray.Add((RunTimeValueBase)argement.Clone()); //可能从StackSlot中读的数据,因此必须Clone后再传入. success = true; }
private void check_para_callbacker(BlockCallBackBase sender,object args) { if (sender.isSuccess) { //CallFuncHeap[sender._intArg].directSet(_tempSlot.getValue()); setCheckedParameter(sender._intArg,_tempSlot.getValue()); check_para(sender); } else { throw new ASRunTimeException("解释器内部错误,参数类型检查",string.Empty); //invokerFrame.throwCastException(token, ((RunTimeValueBase)sender.args).rtType, toCallFunc.signature.parameters[sender._intArg].type); //return; } }
public static void exec_link(StackFrame frame, OpStep step, RunTimeScope scope) { StackSlot l = (StackSlot)step.reg.getSlot(scope, frame); int classid = ((ASBinCode.rtData.rtInt)step.arg2.getValue(scope, frame)).value; var outscope = frame.player.outpackage_runtimescope[classid]; SLOT outpackagescopeslot = ((VariableBase)step.arg1).getSlot(outscope,null); StackSlotAccessor register = (StackSlotAccessor)step.reg; if (register._isassigntarget || register._hasUnaryOrShuffixOrDelete) { l.linkTo(outpackagescopeslot); } else { l.directSet(outpackagescopeslot.getValue()); } frame.endStep(step); }
public void pushParameter(RunTimeValueBase argement,int id,out bool success) { if (doPushNativeModeConstParameter(argement,id,out success)) { return; } var parameters = toCallFunc.signature.parameters; if (parameters.Count > 0 || toCallFunc.IsAnonymous) { bool lastIsPara = false; if (parameters.Count > 0 && parameters[parameters.Count - 1].isPara) { lastIsPara = true; } if (!lastIsPara || id < parameters.Count - 1 || ( toCallFunc.IsAnonymous && !(lastIsPara && id >= parameters.Count - 1) ) ) { if (id < parameters.Count) { //CallFuncHeap[id].directSet(argement); _storeArgementToSlot(id,argement); pushedArgs++; } else { if (!toCallFunc.IsAnonymous) { //参数数量不匹配 invokerFrame.throwArgementException( token, string.Format( "Argument count mismatch on Function/{0}. Expected {1}, got {2}.", player.swc.blocks[toCallFunc.blockid].name,toCallFunc.signature.parameters.Count,pushedArgs + 1 ) ); //***中断本帧本次代码执行进入try catch阶段 success = false; clear_para_slot(invokerFrame,onstackparametercount); if (callbacker != null) { callbacker.noticeRunFailed(); } release(); return; } } } else { //***最后一个是参数数组,并且id大于等于最后一个 SLOT slot = _getArgementSlot(parameters.Count - 1); //CallFuncHeap[toCallFunc.signature.parameters.Count - 1]; if (slot.getValue().rtType == RunTimeDataType.rt_null) { slot.directSet(new ASBinCode.rtData.rtArray()); } ASBinCode.rtData.rtArray arr = (ASBinCode.rtData.rtArray)slot.getValue(); arr.innerArray.Add((RunTimeValueBase)argement.Clone()); //可能从StackSlot中读的数据,因此必须Clone后再传入. } success = true; } else { invokerFrame.throwArgementException( token, string.Format( "Argument count mismatch on Function/{0}. Expected {1}, got {2}.", player.swc.blocks[toCallFunc.blockid].name,toCallFunc.signature.parameters.Count,pushedArgs + 1 ) ); success = false; clear_para_slot(invokerFrame,onstackparametercount); if (callbacker != null) { callbacker.noticeRunFailed(); } release(); } }