private void _primitive_toObj(ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v_temp, StackFrame frame,ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { var c = stackCallers.Pop(); if (v1.rtType < RunTimeDataType.unknown) { c.SetFunctionThis(null); } else { rtObjectBase rtObj = (rtObjectBase)v1; c.SetFunctionThis(rtObj); } if (!c.createParaScope()) { return; } SLOT[] argements = (SLOT[])c.tag; if (argements[1].getValue().rtType != rtNull.nullptr.rtType) { rtArray argArray = (rtArray)argements[1].getValue(); for (int i = 0; i < argArray.innerArray.Count; i++) { bool success; c.pushParameter(argArray.innerArray[i],i,out success); } } c.call(); }
public static void execAdd_String(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { ASBinCode.rtData.rtString a1; if (step.arg1.getValue(scope, frame).rtType == ASBinCode.RunTimeDataType.rt_null) { a1 = nullStr; } else { a1 = (ASBinCode.rtData.rtString)step.arg1.getValue(scope, frame); } ASBinCode.rtData.rtString a2; if (step.arg2.getValue(scope, frame).rtType == ASBinCode.RunTimeDataType.rt_null) { a2 = nullStr; } else { a2 = (ASBinCode.rtData.rtString)step.arg2.getValue(scope, frame); } step.reg.getSlot(scope, frame).setValue(a1.valueString() + a2.valueString());// new ASBinCode.rtData.rtString(a1.valueString() + a2.valueString())); //frame.endStep(step); frame.endStepNoError(); }
private static void _execAdd_InvokeToString_CallBacker( ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v2, StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { ASBinCode.RunTimeDataType v1type = v1.rtType; ASBinCode.RunTimeDataType v2type = v2.rtType; if (v1type == ASBinCode.RunTimeDataType.rt_void) { v1type = ASBinCode.RunTimeDataType.rt_number; } if (v2type == ASBinCode.RunTimeDataType.rt_void) { v2type = ASBinCode.RunTimeDataType.rt_number; } ASBinCode.RunTimeDataType finalType = TypeConverter.getImplicitOpType( v1type, v2type, ASBinCode.OpCode.add, frame.player.swc ); if (finalType == ASBinCode.RunTimeDataType.rt_number) { step.reg.getSlot(scope, frame).setValue( TypeConverter.ConvertToNumber(v1) + TypeConverter.ConvertToNumber(v2) ); frame.endStepNoError(); return; } else if (finalType == ASBinCode.RunTimeDataType.rt_string) { BlockCallBackBase cb = frame.player.blockCallBackPool.create(); cb.setCallBacker(D_Cast_TwoString_Callbacker); cb.args = frame; cb.scope = scope; cb.step = step; OpCast.CastTwoValue(v1, v2, finalType, frame, step.token, scope, frame._tempSlot1, frame._tempSlot2, cb ); return; } else if (finalType == ASBinCode.RunTimeDataType.rt_void) { step.reg.getSlot(scope, frame).setValue(ASBinCode.rtData.rtUndefined.undefined); } else { frame.throwOpException(step.token, ASBinCode.OpCode.add); } frame.endStep(step); }
public static void execBitXOR(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { ASBinCode.RunTimeValueBase v1 = step.arg1.getValue(scope, frame); ASBinCode.RunTimeValueBase v2 = step.arg2.getValue(scope, frame); OpCast.InvokeTwoValueOf(v1, v2, frame, step.token, scope, frame._tempSlot1, frame._tempSlot2, step, _BitXOR_ValueOf_Callbacker); }
public static void execBitOR(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { ASBinCode.RunTimeValueBase v1 = step.arg1.getValue(scope, frame); ASBinCode.RunTimeValueBase v2 = step.arg2.getValue(scope, frame); var f = frame.player.swc.operatorOverrides.getOperatorFunction(OverrideableOperator.bitOr, v1.rtType, v2.rtType); if (f != null) { FunctionCaller fc = frame.player.funcCallerPool.create(frame, step.token); fc.SetFunction(f); fc.loadDefineFromFunction(); if (!fc.createParaScope()) { return; } //fc.releaseAfterCall = true; bool success; fc.pushParameter(v1, 0, out success); fc.pushParameter(v2, 1, out success); fc.returnSlot = step.reg.getSlot(scope, frame); fc.callbacker = fc; fc.call(); } else { OpCast.InvokeTwoValueOf(v1, v2, frame, step.token, scope, frame._tempSlot1, frame._tempSlot2, step, _BitOR_ValueOf_CallBacker); } }
public static void exec_TypeOf(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { var v1 = step.arg1.getValue(scope, frame); if (v1.rtType > RunTimeDataType.unknown) { RunTimeDataType ot; if (TypeConverter.Object_CanImplicit_ToPrimitive(((rtObjectBase)v1).value._class, out ot)) { v1 = TypeConverter.ObjectImplicit_ToPrimitive((rtObjectBase)v1); } } if (v1.rtType == RunTimeDataType.rt_null || v1.rtType == RunTimeDataType.rt_array || v1.rtType > RunTimeDataType.unknown ) { step.reg.getSlot(scope, frame).directSet(OBJECT); } else if (v1.rtType == RunTimeDataType.rt_boolean) { step.reg.getSlot(scope, frame).directSet(BOOLEAN); } else if (v1.rtType == RunTimeDataType.rt_int || v1.rtType == RunTimeDataType.rt_uint || v1.rtType == RunTimeDataType.rt_number ) { step.reg.getSlot(scope, frame).directSet(NUMBER); } else if (v1.rtType == RunTimeDataType.rt_string ) { step.reg.getSlot(scope, frame).directSet(STRING); } else if (v1.rtType == RunTimeDataType.rt_function) { step.reg.getSlot(scope, frame).directSet(FUNCTION); } else if (v1.rtType == RunTimeDataType.rt_void) { step.reg.getSlot(scope, frame).directSet(UNDEFINED); } else if (v1.rtType == RunTimeDataType.unknown || v1.rtType == RunTimeDataType.fun_void ) { frame.throwCastException(step.token, v1.rtType, RunTimeDataType.fun_void); } frame.endStep(step); }
public static void exec_MultiNumber(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { double a1 = step.arg1.getValue(scope, frame).toNumber(); double a2 = step.arg2.getValue(scope, frame).toNumber(); step.reg.getSlot(scope, frame).setValue(a1 * a2); //frame.endStep(step); frame.endStepNoError(); }
public static void execAdd_Number(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { double a1 = step.arg1.getValue(scope, frame).toNumber(); double a2 = step.arg2.getValue(scope, frame).toNumber(); step.reg.getSlot(scope, frame).setValue(a1 + a2);//new ASBinCode.rtData.rtNumber(a1.value +a2.value )); //frame.endStep(step); frame.endStepNoError(); }
private bool make_outpackage_scope(Class cls,IBlockCallBack cb) { ASBinCode.CodeBlock codeblock = player.swc.blocks[cls.outscopeblockid]; HeapSlot[] globaldata = player.genHeapFromCodeBlock(codeblock); Global_Object global = Global_Object.formCodeBlock(codeblock,globaldata,player.swc.classes[0]); ASBinCode.rtData.rtObject globalObj = new ASBinCode.rtData.rtObject(global,null); ASBinCode.RunTimeScope rtscope = player.callBlock( codeblock,globaldata,null, null, //player.static_instance[cls.staticClass.classid].objScope, step.token, cb, globalObj, RunTimeScopeType.outpackagemember ); if (rtscope == null) { invokerFrame.endStep(step); return(false); } globalObj.objScope = rtscope; player.outpackage_runtimescope.Add(cls.classid,rtscope); { var slot = new DynamicPropertySlot(globalObj,true,player.swc.FunctionClass.getRtType()); slot.directSet(player.static_instance[cls.staticClass.classid]); global.createproperty(cls.name,slot); } for (int i = 0; i < player.swc.classes.Count; i++) { if (player.swc.classes[i].mainClass == cls) { if (init_static_class(player.swc.classes[i])) { var slot = new DynamicPropertySlot(globalObj,true,player.swc.FunctionClass.getRtType()); slot.directSet(player.static_instance[player.swc.classes[i].staticClass.classid]); global.createproperty(player.swc.classes[i].name,slot); } else { //***出错了 invokerFrame.endStep(step); return(false); } } } return(true); }
public static void execAdd(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { ASBinCode.RunTimeValueBase v1 = step.arg1.getValue(scope, frame); ASBinCode.RunTimeValueBase v2 = step.arg2.getValue(scope, frame); var f = frame.player.swc.operatorOverrides.getOperatorFunction(OverrideableOperator.addition, v1.rtType, v2.rtType); if (f != null) { FunctionCaller fc = frame.player.funcCallerPool.create(frame, step.token); fc.SetFunction(f); fc.loadDefineFromFunction(); if (!fc.createParaScope()) { return; } //fc.releaseAfterCall = true; bool success; fc.pushParameter(v1, 0, out success); fc.pushParameter(v2, 1, out success); fc.returnSlot = step.reg.getSlot(scope, frame); fc.callbacker = fc; fc.call(); } else if ( (v1.rtType > ASBinCode.RunTimeDataType.unknown && v2.rtType > ASBinCode.RunTimeDataType.unknown) || v1.rtType == ASBinCode.RunTimeDataType.rt_int || v1.rtType == ASBinCode.RunTimeDataType.rt_uint || v1.rtType == ASBinCode.RunTimeDataType.rt_number || v2.rtType == ASBinCode.RunTimeDataType.rt_int || v2.rtType == ASBinCode.RunTimeDataType.rt_uint || v2.rtType == ASBinCode.RunTimeDataType.rt_number ) { OpCast.InvokeTwoValueOf(v1, v2, frame, step.token, scope, frame._tempSlot1, frame._tempSlot2, step, _execAdd_CallBacker); } else //toString { OpCast.InvokeTwoToString(v1, v2, frame, step.token, scope, frame._tempSlot1, frame._tempSlot2, step, _execAdd_InvokeToString_CallBacker); } }
public static void execIncUInt(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { var v = step.arg1.getValue(scope, frame); { ASBinCode.rtData.rtUInt iv = (ASBinCode.rtData.rtUInt)v; iv.value++; ((LeftValueBase)step.arg1).getSlot(scope, frame).directSet(iv); ((ASBinCode.LeftValueBase)step.reg).getSlot(scope, frame).setValue(iv.value); } //frame.endStep(step); frame.endStepNoError(); }
private static void _execSub_CallBacker( ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v2, StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope ) { double n1 = TypeConverter.ConvertToNumber(v1); double n2 = TypeConverter.ConvertToNumber(v2); { step.reg.getSlot(scope, frame).setValue(n1 - n2);// ((ASBinCode.rtData.rtNumber)v1).value - ((ASBinCode.rtData.rtNumber)v2).value);//new ASBinCode.rtData.rtNumber(((ASBinCode.rtData.rtNumber)v1).value - ((ASBinCode.rtData.rtNumber)v2).value)); } //frame.endStep(step); frame.endStepNoError(); }
public FrameInfo(ASBinCode.CodeBlock block, int codeLinePtr, ASBinCode.RunTimeScope scope, //ASBinCode.RunTimeValueBase scope_thispointer, int offset, StackSlot[] stack ) { this.codeLinePtr = codeLinePtr; this.block = block; //this.scope = scope; //this.scope_thispointer = scope_thispointer; this.offset = offset; this.stack = stack; }
public static void execSuffixDecInt(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { var v = step.arg1.getValue(scope, frame); { ASBinCode.rtData.rtInt iv = (ASBinCode.rtData.rtInt)v; step.reg.getSlot(scope, frame).setValue(iv.value); iv.value--; ((LeftValueBase)step.arg1).getSlot(scope, frame).directSet(iv); } frame.endStep(step); }
public static void execDecInt(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { var v = step.arg1.getValue(scope, frame); StackSlotAccessor register = step.arg1 as StackSlotAccessor; if (register != null) { ((StackSlot)register.getSlotForAssign(scope, frame)).linkTo(null); } { ASBinCode.rtData.rtInt iv = (ASBinCode.rtData.rtInt)v; iv.value--; ((LeftValueBase)step.arg1).getSlot(scope, frame).directSet(iv); ((ASBinCode.LeftValueBase)step.reg).getSlot(scope, frame).setValue(iv.value); } //frame.endStep(step); frame.endStepNoError(); }
private static void _func_ToObj(ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v2, StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { var _class = frame.player.swc.classes[0]; //frame.instanceCreator = new InstanceCreator(frame.player, frame, step.token, _class); frame.activeInstanceCreator(step.token, _class); frame.instanceCreator.constructor = (ASBinCode.rtData.rtObjectBase)v1; if (!frame.instanceCreator.prepareConstructorArgements()) { return; } frame.endStep(step); }
//abstract class baseinstancecallbacker : IBlockCallBack //{ // public object args // { // get // ; // set // ; // } // public ASBinCode.rtti.Object obj { get; set; } // public ASBinCode.IRunTimeScope objScope { get; set; } // public ASBinCode.rtData.rtObject rtObject { get; set; } // public abstract void call(object args); //} //class afterCreateStaticInstance : baseinstancecallbacker //{ // public override void call(object args) // { // object[] a = (object[])args; // exec_step0( // (Player)a[0], // (StackFrame)a[1], // (ASBinCode.OpStep)a[2], // (ASBinCode.rtti.Class)a[3], // (ASBinCode.IRunTimeScope)a[4] // ); // } //} //class afterCreateOutScope : baseinstancecallbacker //{ // public override void call(object args) // { // object[] a = (object[])args; // exec_step1( // (Player)a[0], // (StackFrame)a[1], // (ASBinCode.OpStep)a[2], // (ASBinCode.rtti.Class)a[3], // (ASBinCode.IRunTimeScope)a[4] // ); // } //} //class afterCreateInstanceData : baseinstancecallbacker //{ // public override void call(object args) // { // object[] a = (object[])args; // exec_step2( // (Player)a[0], // (StackFrame)a[1], // (ASBinCode.OpStep)a[2], // obj,objScope, // (ASBinCode.IRunTimeScope)a[4], // rtObject // ); // } //} //class afterCallConstructor : baseinstancecallbacker //{ // public override void call(object args) // { // object[] a = (object[])args; // exec_step3( // (ASBinCode.OpStep)a[0], // obj,objScope, // (ASBinCode.IRunTimeScope)a[1], // (StackFrame)a[2] // ); // } //} public static void init_static(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { var player = frame.player; int classid = ((ASBinCode.rtData.rtInt)step.arg1.getValue(scope, frame)).value; ASBinCode.rtti.Class as3class = player.swc.classes[classid]; //init_static_class(player, frame, as3class,step.token, scope); if (InstanceCreator.init_static_class(as3class, player, step.token)) { //frame.endStep(step); frame.endStepNoError(); } //InstanceCreator ic = new InstanceCreator(player, frame, step.token, as3class); //if (ic.init_static_class(as3class)) //{ // frame.endStep(step); //} }
private static void _BitUnSignRightShift_ValueOf_Callbacker( ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v2, StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { uint n1 = TypeConverter.ConvertToUInt(v1, frame, step.token); int n2 = TypeConverter.ConvertToInt(v2); if (n2 < 0) { n2 = 0; } else if (n2 > 31) { n2 = 31; } uint r = n1 >> n2; step.reg.getSlot(scope, frame).setValue(r); //frame.endStep(step); frame.endStepNoError(); }
public static void exec(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { //int classid = ((ASBinCode.rtData.rtInt)step.arg1.getValue(scope)).value; //ASBinCode.rtti.Class as3class = player.swc.classes[classid]; //exec_createinstance(as3class, player, frame, step, scope); //frame.instanceCreator.objectResult = step.reg.getISlot(scope); frame.instanceCreator.step = step; frame.instanceCreator.token = step.token; frame.instanceCreator.objectStoreToSlot = step.reg.getSlot(scope, frame); BlockCallBackBase cb = frame.player.blockCallBackPool.create(); cb.args = frame; cb.setCallBacker(D_objcreated); cb.scope = scope; cb.step = step; frame.instanceCreator.callbacker = cb; frame.instanceCreator.createInstance(); }
public static void execNeg(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { ASBinCode.RunTimeValueBase v = step.arg1.getValue(scope, frame); if (v.rtType != ASBinCode.RunTimeDataType.rt_number) { var f = frame.player.swc.operatorOverrides.getOperatorFunction(OverrideableOperator.Unary_negation, v.rtType, RunTimeDataType.unknown); if (f != null) { FunctionCaller fc = frame.player.funcCallerPool.create(frame, step.token); //fc.releaseAfterCall = true; fc.SetFunction(f); fc.loadDefineFromFunction(); if (!fc.createParaScope()) { return; } bool success; fc.pushParameter(v, 0, out success); fc.returnSlot = step.reg.getSlot(scope, frame); fc.callbacker = fc; fc.call(); return; } else { OpCast.InvokeTwoValueOf(v, ASBinCode.rtData.rtNull.nullptr, frame, step.token, scope, frame._tempSlot1, frame._tempSlot2, step, _execNeg_ValueOf_Callbacker); } } else { step.reg.getSlot(scope, frame).setValue(-((ASBinCode.rtData.rtNumber)v).value);//new ASBinCode.rtData.rtNumber( -((ASBinCode.rtData.rtNumber)v).value)); //frame.endStep(step); frame.endStepNoError(); } }
public static void execUnaryPlus(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { ASBinCode.RunTimeValueBase v = step.arg1.getValue(scope, frame); var f = frame.player.swc.operatorOverrides.getOperatorFunction(OverrideableOperator.Unary_plus, v.rtType, RunTimeDataType.unknown); if (f != null) { FunctionCaller fc = frame.player.funcCallerPool.create(frame, step.token); //fc.releaseAfterCall = true; fc.SetFunction(f); fc.loadDefineFromFunction(); if (!fc.createParaScope()) { return; } bool success; fc.pushParameter(v, 0, out success); fc.returnSlot = step.reg.getSlot(scope, frame); fc.callbacker = fc; fc.call(); return; } else { BlockCallBackBase cb = frame.player.blockCallBackPool.create(); cb.scope = scope; cb.step = step; cb.args = frame; cb.setCallBacker(_tonumber_cb); OpCast.CastValue(v, RunTimeDataType.rt_number, frame, step.token, scope, frame._tempSlot1, cb, false); } }
private static void _execAdd_CallBacker( ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v2, StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { ASBinCode.RunTimeDataType v1type = v1.rtType; ASBinCode.RunTimeDataType v2type = v2.rtType; if (v1type == ASBinCode.RunTimeDataType.rt_void) { v1type = ASBinCode.RunTimeDataType.rt_number; } if (v2type == ASBinCode.RunTimeDataType.rt_void) { v2type = ASBinCode.RunTimeDataType.rt_number; } if (v1type > ASBinCode.RunTimeDataType.unknown || v2type > ASBinCode.RunTimeDataType.unknown) { //***调用toString()*** OpCast.InvokeTwoToString(v1, v2, frame, step.token, scope, frame._tempSlot1, frame._tempSlot2, step, _execAdd_InvokeToString_CallBacker); } //else if (v1type > ASBinCode.RunTimeDataType.unknown) //{ // OpCast.InvokeTwoToString(v1, v2, frame, step.token, scope, // frame._tempSlot1, frame._tempSlot2, step, _execAdd_InvokeToString_CallBacker); //} //else if (v2type > ASBinCode.RunTimeDataType.unknown) //{ //} else { _execAdd_InvokeToString_CallBacker(v1, v2, frame, step, scope); } }
public static void execBitNot(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { ASBinCode.RunTimeValueBase v1 = step.arg1.getValue(scope, frame); OpCast.InvokeTwoValueOf(v1, ASBinCode.rtData.rtNull.nullptr, frame, step.token, scope, frame._tempSlot1, frame._tempSlot2, step, _BitNot_ValueOf_Callbacker); }
private static void _BitXOR_ValueOf_Callbacker(ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v2, StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { uint n1 = TypeConverter.ConvertToUInt(v1, frame, step.token); uint n2 = TypeConverter.ConvertToUInt(v2, frame, step.token); int r = (int)(n1 ^ n2); step.reg.getSlot(scope, frame).setValue(r); //frame.endStep(step); frame.endStepNoError(); }
private static void _execDecrement_toString_Callbacker(ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v2, StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope ) { double n = TypeConverter.ConvertToNumber(v1); ASBinCode.rtData.rtNumber num = new ASBinCode.rtData.rtNumber(--n); ((ASBinCode.LeftValueBase)step.reg).getSlot(scope, frame).directSet(num); frame.endStep(step); }
private static void _BitNot_ValueOf_Callbacker(ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v2, StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { int n1 = TypeConverter.ConvertToInt(v1); int r = ~n1; step.reg.getSlot(scope, frame).setValue(r); //frame.endStep(step); frame.endStepNoError(); }
private static void _execSuffixInc_ValueOf_Callbacker(ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v2, StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { if (v1.rtType > ASBinCode.RunTimeDataType.unknown) { OpCast.InvokeTwoToString(v1, ASBinCode.rtData.rtNull.nullptr, frame, step.token, scope, frame._tempSlot1, frame._tempSlot2, step, _execSuffixInc_toString_Callbacker); } else { double n = TypeConverter.ConvertToNumber(v1); step.reg.getSlot(scope, frame).setValue(n); ASBinCode.rtData.rtNumber num = new ASBinCode.rtData.rtNumber(++n); StackSlotAccessor register = step.arg1 as StackSlotAccessor; if (register != null) { bool issuccess; ((StackSlot)register.getSlotForAssign(scope, frame)).assign(num, out issuccess); if (!issuccess) { frame.throwError(step.token, 0, "操作失败"); } } else { ((ASBinCode.LeftValueBase)step.arg1).getSlot(scope, frame).directSet(num); } frame.endStep(step); } }
public static void execIncrement(StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { var v = step.arg1.getValue(scope, frame); StackSlotAccessor register = step.arg1 as StackSlotAccessor; if (register != null) { ((StackSlot)register.getSlotForAssign(scope, frame)).linkTo(null); } switch (v.rtType) { case ASBinCode.RunTimeDataType.rt_int: { ASBinCode.rtData.rtInt iv = (ASBinCode.rtData.rtInt)v; iv.value++; ((LeftValueBase)step.arg1).getSlot(scope, frame).directSet(iv); step.reg.getSlot(scope, frame).setValue(iv.value); } break; case ASBinCode.RunTimeDataType.rt_uint: { ASBinCode.rtData.rtUInt iv = (ASBinCode.rtData.rtUInt)v; iv.value++; ((LeftValueBase)step.arg1).getSlot(scope, frame).directSet(iv); step.reg.getSlot(scope, frame).setValue(iv.value); } break; case ASBinCode.RunTimeDataType.rt_number: { ASBinCode.rtData.rtNumber iv = (ASBinCode.rtData.rtNumber)v; iv.value++; ((LeftValueBase)step.arg1).getSlot(scope, frame).directSet(iv); step.reg.getSlot(scope, frame).setValue(iv.value); } break; case ASBinCode.RunTimeDataType.rt_string: { double n = TypeConverter.ConvertToNumber(v); if (string.IsNullOrEmpty(((ASBinCode.rtData.rtString)v).value)) { n = 0; } ASBinCode.rtData.rtNumber num = new ASBinCode.rtData.rtNumber(++n); step.reg.getSlot(scope, frame).directSet(num); } break; case ASBinCode.RunTimeDataType.rt_boolean: case ASBinCode.RunTimeDataType.rt_void: case ASBinCode.RunTimeDataType.rt_null: { double n = TypeConverter.ConvertToNumber(v); ASBinCode.rtData.rtNumber num = new ASBinCode.rtData.rtNumber(++n); ((ASBinCode.LeftValueBase)step.reg).getSlot(scope, frame).directSet(num); } break; case ASBinCode.RunTimeDataType.unknown: default: { OpCast.InvokeTwoValueOf(v, ASBinCode.rtData.rtNull.nullptr, frame, step.token, scope, frame._tempSlot1, frame._tempSlot2, step, _execIncrement_ValueOf_Callbacker); return; } } //frame.endStep(step); frame.endStepNoError(); }
private static void _execIncrement_ValueOf_Callbacker(ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v2, StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope ) { if (v1.rtType > ASBinCode.RunTimeDataType.unknown) { OpCast.InvokeTwoToString(v1, ASBinCode.rtData.rtNull.nullptr, frame, step.token, scope, frame._tempSlot1, frame._tempSlot2, step, _execIncrement_ToString_Callbacker); } else { double n = TypeConverter.ConvertToNumber(v1); ASBinCode.rtData.rtNumber num = new ASBinCode.rtData.rtNumber(++n); ((ASBinCode.LeftValueBase)step.reg).getSlot(scope, frame).directSet(num); frame.endStep(step); } }
private static void _execSuffixDec_toString_Callbacker(ASBinCode.RunTimeValueBase v1, ASBinCode.RunTimeValueBase v2, StackFrame frame, ASBinCode.OpStep step, ASBinCode.RunTimeScope scope) { double n = TypeConverter.ConvertToNumber(v1); step.reg.getSlot(scope, frame).setValue(n); ASBinCode.rtData.rtNumber num = new ASBinCode.rtData.rtNumber(--n); StackSlotAccessor register = step.arg1 as StackSlotAccessor; if (register != null) { bool issuccess; register.getSlotForAssign(scope, frame).assign(num, out issuccess); if (!issuccess) { frame.throwError(step.token, 0, "操作失败"); } } else { ((ASBinCode.LeftValueBase)step.arg1).getSlot(scope, frame).directSet(num); } frame.endStep(step); }