public override void execute3(RunTimeValueBase thisObj,FunctionDefine functionDefine,SLOT returnSlot,SourceToken token,StackFrame stackframe,out bool success) { if (argements[0].rtType == RunTimeDataType.rt_null) { success = false; stackframe.throwArgementException(token,"参数elementType不能为null"); return; } Class _arraylist_ = ((ASBinCode.rtData.rtObjectBase)thisObj).value._class; var arr = stackframe.player.alloc_pureHostedOrLinkedObject(_arraylist_.instanceClass); LinkSystemObject linkobj = (LinkSystemObject)arr.value; try { object lo; if (stackframe.player.linktypemapper.rtValueToLinkObject( argements[0], stackframe.player.linktypemapper.getLinkType( functionDefine.signature.parameters[0].type ), bin,true,out lo )) { linkobj.SetLinkData(new ArrayList((ICollection)lo)); returnSlot.directSet(arr); success = true; } else { stackframe.throwCastException(token,argements[0].rtType, functionDefine.signature.parameters[0].type ); success = false; } } catch (KeyNotFoundException) { success = false; stackframe.throwArgementException(token,"类型" + argements[0].rtType + "不是一个链接到系统类库的对象,不能创建托管数组"); } catch (ArgumentOutOfRangeException a) { success = false; stackframe.throwAneException(token,a.Message); } catch { throw new EngineException(); } }
public override void execute3(RunTimeValueBase thisObj,FunctionDefine functionDefine,SLOT returnSlot,SourceToken token,StackFrame stackframe,out bool success) { Class _arraylist_ = ((ASBinCode.rtData.rtObjectBase)thisObj).value._class; var arr = stackframe.player.alloc_pureHostedOrLinkedObject(_arraylist_.instanceClass); LinkSystemObject linkobj = (LinkSystemObject)arr.value; try { int capacity = TypeConverter.ConvertToInt(argements[0]); linkobj.SetLinkData(new ArrayList(capacity)); returnSlot.directSet(arr); success = true; } //catch (KeyNotFoundException) //{ // success = false; // stackframe.throwArgementException(token, "类型" + argements[0].rtType + "不是一个链接到系统类库的对象,不能创建托管数组"); //} catch (ArgumentOutOfRangeException a) { success = false; stackframe.throwAneException(token,a.Message); } catch { throw new EngineException(); } }
public override void execute3(RunTimeValueBase thisObj,FunctionDefine functionDefine,SLOT returnSlot,SourceToken token,StackFrame stackframe,out bool success) { success = true; if (argements[0].rtType == RunTimeDataType.rt_null) { success = false; stackframe.throwArgementException(token,"参数elementType不能为null"); return; } Class cls = bin.getClassByRunTimeDataType(argements[0].rtType).instanceClass; int length1 = TypeConverter.ConvertToInt(argements[1]); int length2 = TypeConverter.ConvertToInt(argements[2]); Class _array_ = ((ASBinCode.rtData.rtObjectBase)thisObj).value._class; var arr = stackframe.player.alloc_pureHostedOrLinkedObject(_array_.instanceClass); LinkSystemObject lo = (LinkSystemObject)arr.value; try { RunTimeDataType et = cls.getRtType(); RunTimeDataType ot; if (TypeConverter.Object_CanImplicit_ToPrimitive(cls,out ot)) { et = ot; } Type elementType = stackframe.player.linktypemapper.getLinkType(et); lo.SetLinkData(Array.CreateInstance(elementType,length1,length2)); returnSlot.directSet(arr); } catch (KeyNotFoundException) { success = false; stackframe.throwArgementException(token,"类型" + cls + "不是一个链接到系统类库的对象,不能创建托管数组"); } catch (ArgumentOutOfRangeException a) { success = false; stackframe.throwAneException(token,a.Message); } catch { throw new EngineException(); } }