File tree Expand file tree Collapse file tree 2 files changed +23
-5
lines changed
ICSharpCode.Decompiler.Tests/TestCases/Pretty
ICSharpCode.Decompiler/CSharp Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 1- // Copyright (c) AlphaSierraPapa for the SharpDevelop Team
1+ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team
22//
33// Permission is hereby granted, free of charge, to any person obtaining a copy of this
44// software and associated documentation files (the "Software"), to deal in the Software
@@ -28,6 +28,12 @@ public enum SimpleEnum
2828 Item2
2929 }
3030
31+ public enum NoZero
32+ {
33+ Item1 = 1 ,
34+ Item2
35+ }
36+
3137 public enum OutOfOrderMembers
3238 {
3339 Item1 = 1 ,
@@ -135,5 +141,18 @@ public object PreservingTypeWhenBoxedTwoEnum()
135141 {
136142 return AttributeTargets . Class | AttributeTargets . Delegate ;
137143 }
144+
145+ public void EnumInNotZeroCheck ( SimpleEnum value , NoZero value2 )
146+ {
147+ if ( value != SimpleEnum . Item1 )
148+ {
149+ Console . WriteLine ( ) ;
150+ }
151+
152+ if ( value2 != ( NoZero ) 0 )
153+ {
154+ Console . WriteLine ( ) ;
155+ }
156+ }
138157 }
139158}
Original file line number Diff line number Diff line change 1- // Copyright (c) 2014 Daniel Grunwald
1+ // Copyright (c) 2014 Daniel Grunwald
22//
33// Permission is hereby granted, free of charge, to any person obtaining a copy of this
44// software and associated documentation files (the "Software"), to deal in the Software
@@ -733,9 +733,8 @@ public TranslatedExpression ConvertToBoolean(ExpressionBuilder expressionBuilder
733733 }
734734 else
735735 {
736- var zero = new PrimitiveExpression ( 0 )
737- . WithoutILInstruction ( )
738- . WithRR ( new ConstantResolveResult ( expressionBuilder . compilation . FindType ( KnownTypeCode . Int32 ) , 0 ) ) ;
736+ var zero = expressionBuilder
737+ . ConvertConstantValue ( new ConstantResolveResult ( Type , 0 ) , allowImplicitConversion : true ) ;
739738 var op = negate ? BinaryOperatorType . Equality : BinaryOperatorType . InEquality ;
740739 return new BinaryOperatorExpression ( Expression , op , zero . Expression )
741740 . WithoutILInstruction ( )
You can’t perform that action at this time.
0 commit comments