本文整理匯總了C#中MsgPack.Serialization.Reflection.TracingILGenerator.EmitBrfalse方法的典型用法代碼示例。如果您正苦於以下問題:C# TracingILGenerator.EmitBrfalse方法的具體用法?C# TracingILGenerator.EmitBrfalse怎麽用?C# TracingILGenerator.EmitBrfalse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MsgPack.Serialization.Reflection.TracingILGenerator
的用法示例。
在下文中一共展示了TracingILGenerator.EmitBrfalse方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Branch
public override void Branch( TracingILGenerator il, Label @else )
{
il.TraceWriteLine( "// Brnc->: {0}", this );
foreach ( var expression in this._expressions )
{
expression.LoadValue( il, false );
il.EmitBrfalse( @else );
}
il.TraceWriteLine( "// ->Brnc: {0}", this );
}
示例2: BranchCore
protected virtual void BranchCore( TracingILGenerator il, Label @else )
{
this.LoadValue( il, false );
il.EmitBrfalse( @else );
}
示例3: EmitForEach
/// <summary>
/// Emits 'foreach' statement on the IL stream.
/// </summary>
/// <param name="il">IL generator to be emitted to.</param>
/// <param name="traits"><see cref="CollectionTraits"/> which contains traits of the iterating collection.</param>
/// <param name="collection">'collection' argument index.</param>
/// <param name="bodyEmitter">Delegate to emit body statement.</param>
public static void EmitForEach( TracingILGenerator il, CollectionTraits traits, LocalBuilder collection, Action<TracingILGenerator, Action> bodyEmitter )
{
Contract.Requires( il != null );
Contract.Requires( collection != null );
Contract.Requires( bodyEmitter != null );
var enumerator = il.DeclareLocal( traits.GetEnumeratorMethod.ReturnType, "enumerator" );
// gets enumerator
if ( collection.LocalType.IsValueType )
{
il.EmitAnyLdloca( collection );
}
else
{
il.EmitAnyLdloc( collection );
}
il.EmitAnyCall( traits.GetEnumeratorMethod );
il.EmitAnyStloc( enumerator );
if ( typeof( IDisposable ).IsAssignableFrom( traits.GetEnumeratorMethod.ReturnType ) )
{
il.BeginExceptionBlock();
}
var startLoop = il.DefineLabel( "START_LOOP" );
il.MarkLabel( startLoop );
var endLoop = il.DefineLabel( "END_LOOP" );
var enumeratorType = traits.GetEnumeratorMethod.ReturnType;
MethodInfo moveNextMethod = enumeratorType.GetMethod( "MoveNext", Type.EmptyTypes );
PropertyInfo currentProperty = traits.GetEnumeratorMethod.ReturnType.GetProperty( "Current" );
if ( moveNextMethod == null )
{
moveNextMethod = Metadata._IEnumerator.MoveNext;
}
if ( currentProperty == null )
{
if ( enumeratorType == typeof( IDictionaryEnumerator ) )
{
currentProperty = Metadata._IDictionaryEnumerator.Current;
}
else if ( enumeratorType.IsInterface )
{
if ( enumeratorType.IsGenericType && enumeratorType.GetGenericTypeDefinition() == typeof( IEnumerator<> ) )
{
currentProperty = typeof( IEnumerator<> ).MakeGenericType( traits.ElementType ).GetProperty( "Current" );
}
else
{
currentProperty = Metadata._IEnumerator.Current;
}
}
}
Contract.Assert( currentProperty != null, enumeratorType.ToString() );
// iterates
if ( traits.GetEnumeratorMethod.ReturnType.IsValueType )
{
il.EmitAnyLdloca( enumerator );
}
else
{
il.EmitAnyLdloc( enumerator );
}
il.EmitAnyCall( moveNextMethod );
il.EmitBrfalse( endLoop );
bodyEmitter(
il,
() =>
{
if ( traits.GetEnumeratorMethod.ReturnType.IsValueType )
{
il.EmitAnyLdloca( enumerator );
}
else
{
il.EmitAnyLdloc( enumerator );
}
il.EmitGetProperty( currentProperty );
}
);
il.EmitBr( startLoop );
il.MarkLabel( endLoop );
// Dispose
if ( typeof( IDisposable ).IsAssignableFrom( traits.GetEnumeratorMethod.ReturnType ) )
//.........這裏部分代碼省略.........
示例4: BranchWithOperationResult
private static void BranchWithOperationResult( ILConstruct input, Action<TracingILGenerator, ILConstruct> operation, TracingILGenerator il, Label @else )
{
operation( il, input );
il.EmitBrfalse( @else );
}