/// <summary> /// Emit 'ldtoken' instruction with specified arguments. /// </summary> /// <param name="target"><see cref="System.Reflection.FieldInfo"/> as target.</param> public void EmitLdtoken( System.Reflection.FieldInfo target ) { Contract.Assert( !this.IsEnded ); Contract.Assert( target != null ); // TODO: NLiblet #if !SILVERLIGHT if ( !( target is FieldBuilder ) ) { if ( target.GetRequiredCustomModifiers().Any( item => typeof( IsVolatile ).Equals( item ) ) ) { this.TraceStart(); this.TraceOpCode( OpCodes.Volatile ); this.TraceWriteLine(); } } #endif this.TraceStart(); this.TraceOpCode( OpCodes.Ldtoken ); this.TraceWrite( " " ); this.TraceOperandToken( target ); this.TraceWriteLine(); this._underlying.Emit( OpCodes.Ldtoken, target ); }
/// <summary> /// Emit 'stsfld' instruction with specified arguments. /// </summary> /// <param name="field"><see cref="System.Reflection.FieldInfo"/> as field.</param> public void EmitStsfld( System.Reflection.FieldInfo field ) { Contract.Assert( !this.IsEnded ); Contract.Assert( field != null ); #if !SILVERLIGHT // TODO: NLiblet if ( !( field is FieldBuilder ) ) { if ( field.GetRequiredCustomModifiers().Any( item => typeof( IsVolatile ).Equals( item ) ) ) { this.TraceStart(); this.TraceOpCode( OpCodes.Volatile ); this.TraceWriteLine(); } } #endif this.TraceStart(); this.TraceOpCode( OpCodes.Stsfld ); this.TraceWrite( " " ); this.TraceOperand( field ); this.TraceWriteLine(); this._underlying.Emit( OpCodes.Stsfld, field ); }