Esempio n. 1
0
        public override Value Load()
        {
            var structMirror = containingLocation.Load() as StructMirror;

            Debug.Assert(structMirror?.Type == structType);
            if (structMirror?.Type != structType)
            {
                throw new InvalidOperationException();
            }
            return(structMirror.Fields[valueIndex]);
        }
Esempio n. 2
0
 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();
     }
 }