ValueTypeFieldValueLocation(ValueTypeFieldValueLocation other) { Type = other.Type.GetElementType(); containingLocation = other.containingLocation; field = other.field; valueIndex = other.valueIndex; structType = other.structType; }
public ValueTypeFieldValueLocation(DmdType type, ValueLocation containingLocation, StructMirror structMirror, FieldInfoMirror field) { Type = type ?? throw new ArgumentNullException(nameof(type)); this.containingLocation = containingLocation ?? throw new ArgumentNullException(nameof(containingLocation)); this.field = field ?? throw new ArgumentNullException(nameof(field)); structType = structMirror.Type; Debug.Assert(!field.IsStatic); Debug.Assert(field.DeclaringType == structType); Debug.Assert(containingLocation.Load() is StructMirror); valueIndex = GetValueIndex(field); if ((uint)valueIndex >= (uint)structMirror.Fields.Length) { throw new InvalidOperationException(); } }
public DbgDotNetValueImpl(DbgEngineImpl engine, ValueLocation valueLocation, Value value) { this.engine = engine ?? throw new ArgumentNullException(nameof(engine)); this.valueLocation = valueLocation ?? throw new ArgumentNullException(nameof(valueLocation)); this.value = value ?? throw new ArgumentNullException(nameof(value)); Type = MonoValueTypeCreator.CreateType(engine, value, valueLocation.Type); rawValue = new DbgDotNetRawValueFactory(engine).Create(value, Type); var flags = ValueFlags.None; if (value is PrimitiveValue pv && (pv.Value is null || ((Type.IsPointer || Type.IsFunctionPointer) && boxed0L.Equals(pv.Value)))) { if (Type.IsByRef) { flags |= ValueFlags.IsNullByRef; } else { flags |= ValueFlags.IsNull; } }