public StackSlot(CSWC classfinder,Player player)
        {
            this.player = player;
            store       = new RunTimeValueBase[(int)RunTimeDataType._OBJECT + 1];
            index       = (int)RunTimeDataType.unknown;

            _cache_arraySlot     = new operators.OpAccess_Dot.arraySlot(null,0,classfinder);
            _cache_vectorSlot    = new operators.OpVector.vectorSLot(null,0,classfinder);
            _cache_prototypeSlot = new operators.OpAccess_Dot.prototypeSlot(null,null,null);
            _cache_setthisslot   = new SetThisItemSlot();

            //存储器设置初始值
            for (int i = 0; i < RunTimeDataType._OBJECT + 1; i++)
            {
                RunTimeDataType t = (RunTimeDataType)i;
                if (t != RunTimeDataType.unknown)
                {
                    store[i] = TypeConverter.getDefaultValue(t).getValue(null,null);
                }
            }

            store[RunTimeDataType.rt_array]    = null;
            store[RunTimeDataType.rt_string]   = null;
            store[RunTimeDataType.rt_function] = null;


            _numberValue = (rtNumber)store[RunTimeDataType.rt_number];
            _intValue    = (rtInt)store[RunTimeDataType.rt_int];
            _uintValue   = (rtUInt)store[RunTimeDataType.rt_uint];
            _stringValue = new rtString(string.Empty);

            _functionValue  = new rtFunction(-1,false);
            _functon_result = new rtFunction(-1,false);
        }
Example #2
0
        internal static void _vectorConvertCallBacker(BlockCallBackBase sender,object args)
        {
            StackFrame frame = (StackFrame)sender.args;
            OpStep     step  = sender.step;

            ASBinCode.RunTimeValueBase v = frame._tempSlot1.getValue();
            //ASBinCode.SLOT slot = step.reg.getSlot(sender.scope, frame);

            OpVector.vectorSLot slot = (OpVector.vectorSLot)sender.cacheObjects[0];

            bool success;

            slot.assign(v,out success);

            if (!success)
            {
                frame.throwCastException(step.token,
                                         step.arg1.getValue(sender.scope,frame).rtType,
                                         slot.vector_data.vector_type
                                         );
                frame.endStep(step);
            }
            else
            {
                frame.endStepNoError();
            }
        }