/// <summary> /// Initializes a new instance of the <see cref="MemberOperand"/> class. /// </summary> /// <param name="member">The member to reference.</param> /// <param name="type">The type of data held in the operand.</param> /// <param name="offset">The offset from the base register or absolute address to retrieve.</param> public MemberOperand(RuntimeMember member, SigType type, IntPtr offset) : base(null, type, offset) { if (member == null) throw new ArgumentNullException(@"member"); this.member = member; }
/// <summary> /// Initializes a new instance of <see cref="MemberOperand"/>. /// </summary> /// <param name="field">The runtime field to reference.</param> /// <exception cref="System.ArgumentNullException"><paramref name="field"/> is null.</exception> public MemberOperand(RuntimeField field) : base(null, field.SignatureType, IntPtr.Zero) { if (field == null) throw new ArgumentNullException(@"field"); this.member = field; }
/// <summary> /// Initializes a new instance of the <see cref="MemberOperand"/> class. /// </summary> /// <param name="method">The method to reference.</param> /// <exception cref="System.ArgumentNullException"><paramref name="method"/> is null.</exception> public MemberOperand(RuntimeMethod method) : base(null, BuiltInSigType.IntPtr, IntPtr.Zero) { if (method == null) throw new ArgumentNullException(@"method"); this.member = method; }
/// <summary> /// Creates a new runtime member <see cref="Operand"/>. /// </summary> /// <param name="type">The type.</param> /// <param name="member">The member.</param> /// <param name="offset">The offset.</param> /// <returns></returns> public static Operand CreateRuntimeMember(SigType type, RuntimeMember member, IntPtr offset) { Operand operand = new Operand(type, OperandType.MemoryAddress | OperandType.RuntimeMember); operand.offset = offset; operand.runtimeMember = member; return operand; }
/// <summary> /// Checks that <paramref name="member"/> is a member, which can be linked. /// </summary> /// <param name="member">The member to check.</param> /// <returns> /// True, if the member is valid for linking. /// </returns> protected bool IsValid(RuntimeMember member) { return (member is RuntimeMethod || (member is RuntimeField && FieldAttributes.Static == (FieldAttributes.Static & ((RuntimeField)member).Attributes))); }