public override void Compile( MethodEmitter emitter ) { bool inverse = false; string methodName; switch ( m_Operator ) { case StringOperator.Equal: methodName = "Equals"; break; case StringOperator.NotEqual: methodName = "Equals"; inverse = true; break; case StringOperator.Contains: methodName = "Contains"; break; case StringOperator.StartsWith: methodName = "StartsWith"; break; case StringOperator.EndsWith: methodName = "EndsWith"; break; default: throw new InvalidOperationException( "Invalid string comparison operator." ); } if ( m_IgnoreCase || methodName == "Equals" ) { Type type = ( m_IgnoreCase ? typeof( Insensitive ) : typeof( String ) ); emitter.BeginCall( type.GetMethod( methodName, BindingFlags.Public | BindingFlags.Static, null, new Type[] { typeof( string ), typeof( string ) }, null ) ); emitter.Chain( m_Property ); m_Value.Load( emitter ); emitter.FinishCall(); } else { Label notNull = emitter.CreateLabel(); Label moveOn = emitter.CreateLabel(); LocalBuilder temp = emitter.AcquireTemp( m_Property.Type ); emitter.Chain( m_Property ); emitter.StoreLocal( temp ); emitter.LoadLocal( temp ); emitter.BranchIfTrue( notNull ); emitter.Load( false ); emitter.Pop(); emitter.Branch( moveOn ); emitter.MarkLabel( notNull ); emitter.LoadLocal( temp ); emitter.BeginCall( typeof( string ).GetMethod( methodName, BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof( string ) }, null ) ); m_Value.Load( emitter ); emitter.FinishCall(); emitter.MarkLabel( moveOn ); } if ( m_Not != inverse ) emitter.LogicalNot(); }