public unsafe object this[int index] { get { if (index < fields.Length && index >= 0) { fixed(StackObject *ptr = fields) { StackObject *esp = &ptr[index]; return(StackObject.ToObject(esp, null, managedObjs)); } } else { if (Type.FirstCLRBaseType != null && Type.FirstCLRBaseType is Enviorment.CrossBindingAdaptor) { CLRType clrType = type.AppDomain.GetType(((Enviorment.CrossBindingAdaptor)Type.FirstCLRBaseType).BaseCLRType) as CLRType; var field = clrType.GetField(index); var obj = field.GetValue(clrInstance); return(obj); } else { throw new TypeLoadException(); } } } }
internal unsafe void AssignFromStack(int fieldIdx, StackObject *esp, Enviorment.AppDomain appdomain, IList <object> managedStack) { if (fieldIdx < fields.Length && fieldIdx >= 0) { AssignFromStackSub(ref fields[fieldIdx], fieldIdx, esp, managedStack); } else { if (Type.FirstCLRBaseType != null && Type.FirstCLRBaseType is Enviorment.CrossBindingAdaptor) { CLRType clrType = appdomain.GetType(((Enviorment.CrossBindingAdaptor)Type.FirstCLRBaseType).BaseCLRType) as CLRType; var field = clrType.GetField(fieldIdx); clrType.SetFieldValue(fieldIdx, ref clrInstance, field.FieldType.CheckCLRTypes(ILIntepreter.CheckAndCloneValueType(StackObject.ToObject(esp, appdomain, managedStack), appdomain))); } else { throw new TypeLoadException(); } } }
internal unsafe void PushToStack(int fieldIdx, StackObject *esp, Enviorment.AppDomain appdomain, List <object> managedStack) { if (fieldIdx < fields.Length && fieldIdx >= 0) { PushToStackSub(ref fields[fieldIdx], fieldIdx, esp, managedStack); } else { if (Type.FirstCLRBaseType != null && Type.FirstCLRBaseType is Enviorment.CrossBindingAdaptor) { CLRType clrType = appdomain.GetType(((Enviorment.CrossBindingAdaptor)Type.FirstCLRBaseType).BaseCLRType) as CLRType; var field = clrType.GetField(fieldIdx); var obj = field.GetValue(clrInstance); ILIntepreter.PushObject(esp, managedStack, obj); } else { throw new TypeLoadException(); } } }
public unsafe object this[int index] { get { if (index < fields.Length && index >= 0) { fixed(StackObject *ptr = fields) { StackObject *esp = &ptr[index]; return(StackObject.ToObject(esp, null, managedObjs)); } } else { if (Type.FirstCLRBaseType != null && Type.FirstCLRBaseType is Enviorment.CrossBindingAdaptor) { CLRType clrType = type.AppDomain.GetType(((Enviorment.CrossBindingAdaptor)Type.FirstCLRBaseType).BaseCLRType) as CLRType; var field = clrType.GetField(index); var obj = field.GetValue(clrInstance); return(obj); } else { throw new TypeLoadException(); } } } set { value = ILIntepreter.CheckAndCloneValueType(value, type.AppDomain); if (index < fields.Length && index >= 0) { fixed(StackObject *ptr = fields) { StackObject *esp = &ptr[index]; if (value != null) { if (value.GetType().IsPrimitive) { ILIntepreter.UnboxObject(esp, value); } else { esp->ObjectType = ObjectTypes.Object; esp->Value = index; managedObjs[index] = value; } } else { *esp = StackObject.Null; } } } else { if (Type.FirstCLRBaseType != null && Type.FirstCLRBaseType is Enviorment.CrossBindingAdaptor) { CLRType clrType = type.AppDomain.GetType(((Enviorment.CrossBindingAdaptor)Type.FirstCLRBaseType).BaseCLRType) as CLRType; var field = clrType.GetField(index); field.SetValue(clrInstance, value); } else { throw new TypeLoadException(); } } } }