748 references to UnaryOperatorKind
Microsoft.CodeAnalysis.CSharp (696)
Binder\Binder.ValueChecks.cs (8)
4635
var prefix = increment.OperatorKind.Operator() is
UnaryOperatorKind
.PrefixIncrement or
UnaryOperatorKind
.PrefixDecrement;
4636
Debug.Assert(prefix || increment.OperatorKind.Operator() is
UnaryOperatorKind
.PostfixIncrement or
UnaryOperatorKind
.PostfixDecrement);
5395
var prefix = increment.OperatorKind.Operator() is
UnaryOperatorKind
.PrefixIncrement or
UnaryOperatorKind
.PrefixDecrement;
5396
Debug.Assert(prefix || increment.OperatorKind.Operator() is
UnaryOperatorKind
.PostfixIncrement or
UnaryOperatorKind
.PostfixDecrement);
Binder\Binder_Operators.cs (82)
1823
UnaryOperatorAnalysisResult? bestTrue = nonExtensionUnaryOperatorOverloadResolution(syntax, t, result,
UnaryOperatorKind
.True, leftPlaceholder, ref useSiteInfo);
1829
bestFalse = nonExtensionUnaryOperatorOverloadResolution(syntax, t, result,
UnaryOperatorKind
.False, leftPlaceholder, ref useSiteInfo);
1925
UnaryOperatorKind
kind,
1983
UnaryOperatorAnalysisResult? bestTrue = extensionUnaryOperatorOverloadResolution(syntax, extensionCandidates, result, extensionContainingType,
UnaryOperatorKind
.True, leftPlaceholder, ref useSiteInfo);
1989
bestFalse = extensionUnaryOperatorOverloadResolution(syntax, extensionCandidates, result, extensionContainingType,
UnaryOperatorKind
.False, leftPlaceholder, ref useSiteInfo);
2016
UnaryOperatorKind
kind,
2285
UnaryOperatorKind
kind,
2324
UnaryOperatorKind
kind,
2356
UnaryOperatorKind
kind,
2391
if (kind ==
UnaryOperatorKind
.UnaryMinus &&
2431
UnaryOperatorKind
kind,
3284
UnaryOperatorKind
kind = SyntaxKindToUnaryOperatorKind(node.Kind());
3313
kind.WithType(
UnaryOperatorKind
.Dynamic).WithOverflowChecksIfApplicable(CheckOverflowAtRuntime),
3454
UnaryOperatorKind
kind,
3463
Debug.Assert(kind is (
UnaryOperatorKind
.PrefixIncrement or
UnaryOperatorKind
.PrefixDecrement or
UnaryOperatorKind
.PostfixIncrement or
UnaryOperatorKind
.PostfixDecrement));
3468
if (kind is not (
UnaryOperatorKind
.PrefixIncrement or
UnaryOperatorKind
.PrefixDecrement or
UnaryOperatorKind
.PostfixIncrement or
UnaryOperatorKind
.PostfixDecrement) ||
3477
if ((kind is (
UnaryOperatorKind
.PostfixIncrement or
UnaryOperatorKind
.PostfixDecrement) && resultIsUsed) ||
3484
(kind is
UnaryOperatorKind
.PrefixIncrement or
UnaryOperatorKind
.PostfixIncrement ?
3488
ordinaryName = kind is
UnaryOperatorKind
.PrefixIncrement or
UnaryOperatorKind
.PostfixIncrement ?
3498
UnaryOperatorKind
kind,
3538
UnaryOperatorKind
kind,
3626
(kind |
UnaryOperatorKind
.UserDefined).WithOverflowChecksIfApplicable(checkOverflowAtRuntime),
3651
(kind |
UnaryOperatorKind
.UserDefined).WithOverflowChecksIfApplicable(checkOverflowAtRuntime),
3687
UnaryOperatorKind
kind,
3773
UnaryOperatorKind
kind,
4347
UnaryOperatorKind
kind = SyntaxKindToUnaryOperatorKind(node.Kind());
4380
operatorKind: kind.WithType(
UnaryOperatorKind
.Dynamic).WithOverflowChecksIfApplicable(CheckOverflowAtRuntime),
4417
UnaryOperatorKind
resultOperatorKind = signature.Kind;
4436
UnaryOperatorKind
kind,
4453
UnaryOperatorKind
newKind = kind.Operator().WithType(upconvertSpecialType);
4461
var binder = kind.Operator() ==
UnaryOperatorKind
.BitwiseComplement ?
4471
UnaryOperatorKind
kind,
4546
private static object? FoldNeverOverflowUnaryOperator(
UnaryOperatorKind
kind, ConstantValue value)
4551
case
UnaryOperatorKind
.DecimalUnaryMinus:
4553
case
UnaryOperatorKind
.DoubleUnaryMinus:
4554
case
UnaryOperatorKind
.FloatUnaryMinus:
4556
case
UnaryOperatorKind
.DecimalUnaryPlus:
4558
case
UnaryOperatorKind
.FloatUnaryPlus:
4559
case
UnaryOperatorKind
.DoubleUnaryPlus:
4561
case
UnaryOperatorKind
.LongUnaryPlus:
4563
case
UnaryOperatorKind
.ULongUnaryPlus:
4565
case
UnaryOperatorKind
.IntUnaryPlus:
4566
case
UnaryOperatorKind
.NIntUnaryPlus:
4568
case
UnaryOperatorKind
.UIntUnaryPlus:
4569
case
UnaryOperatorKind
.NUIntUnaryPlus:
4571
case
UnaryOperatorKind
.BoolLogicalNegation:
4573
case
UnaryOperatorKind
.IntBitwiseComplement:
4575
case
UnaryOperatorKind
.LongBitwiseComplement:
4577
case
UnaryOperatorKind
.UIntBitwiseComplement:
4579
case
UnaryOperatorKind
.ULongBitwiseComplement:
4586
private static object? FoldUncheckedIntegralUnaryOperator(
UnaryOperatorKind
kind, ConstantValue value)
4592
case
UnaryOperatorKind
.LongUnaryMinus:
4594
case
UnaryOperatorKind
.IntUnaryMinus:
4602
private static object? FoldCheckedIntegralUnaryOperator(
UnaryOperatorKind
kind, ConstantValue value)
4608
case
UnaryOperatorKind
.LongUnaryMinus:
4610
case
UnaryOperatorKind
.IntUnaryMinus:
4618
private static object? FoldNativeIntegerOverflowingUnaryOperator(
UnaryOperatorKind
kind, ConstantValue value)
4624
case
UnaryOperatorKind
.NIntUnaryMinus:
4626
case
UnaryOperatorKind
.NIntBitwiseComplement:
4627
case
UnaryOperatorKind
.NUIntBitwiseComplement:
4635
public static
UnaryOperatorKind
SyntaxKindToUnaryOperatorKind(SyntaxKind kind)
4639
case SyntaxKind.PreIncrementExpression: return
UnaryOperatorKind
.PrefixIncrement;
4640
case SyntaxKind.PostIncrementExpression: return
UnaryOperatorKind
.PostfixIncrement;
4641
case SyntaxKind.PreDecrementExpression: return
UnaryOperatorKind
.PrefixDecrement;
4642
case SyntaxKind.PostDecrementExpression: return
UnaryOperatorKind
.PostfixDecrement;
4643
case SyntaxKind.UnaryPlusExpression: return
UnaryOperatorKind
.UnaryPlus;
4644
case SyntaxKind.UnaryMinusExpression: return
UnaryOperatorKind
.UnaryMinus;
4645
case SyntaxKind.LogicalNotExpression: return
UnaryOperatorKind
.LogicalNegation;
4646
case SyntaxKind.BitwiseNotExpression: return
UnaryOperatorKind
.BitwiseComplement;
6077
private void CheckNativeIntegerFeatureAvailability(
UnaryOperatorKind
operatorKind, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
6084
switch (operatorKind &
UnaryOperatorKind
.TypeMask)
6086
case
UnaryOperatorKind
.NInt:
6087
case
UnaryOperatorKind
.NUInt:
Binder\Binder_Statements.cs (2)
2701
UnaryOperatorKind
.DynamicTrue,
2751
var best = this.UnaryOperatorOverloadResolution(
UnaryOperatorKind
.True, expr, node, diagnostics, ref discardedOperatorResolutionForReporting, out LookupResultKind resultKind, out ImmutableArray<MethodSymbol> originalUserDefinedOperators);
Binder\Binder_TupleOperators.cs (3)
146
UnaryOperatorKind
boolOpKind;
150
boolOpKind =
UnaryOperatorKind
.False;
153
boolOpKind =
UnaryOperatorKind
.True;
Binder\Semantics\Operators\OperatorFacts.cs (13)
231
public static string UnaryOperatorNameFromOperatorKind(
UnaryOperatorKind
kind, bool isChecked)
233
switch (kind &
UnaryOperatorKind
.OpMask)
235
case
UnaryOperatorKind
.UnaryPlus: return WellKnownMemberNames.UnaryPlusOperatorName;
236
case
UnaryOperatorKind
.UnaryMinus: return isChecked ? WellKnownMemberNames.CheckedUnaryNegationOperatorName : WellKnownMemberNames.UnaryNegationOperatorName;
237
case
UnaryOperatorKind
.BitwiseComplement: return WellKnownMemberNames.OnesComplementOperatorName;
238
case
UnaryOperatorKind
.LogicalNegation: return WellKnownMemberNames.LogicalNotOperatorName;
239
case
UnaryOperatorKind
.PostfixIncrement:
240
case
UnaryOperatorKind
.PrefixIncrement: return isChecked ? WellKnownMemberNames.CheckedIncrementOperatorName : WellKnownMemberNames.IncrementOperatorName;
241
case
UnaryOperatorKind
.PostfixDecrement:
242
case
UnaryOperatorKind
.PrefixDecrement: return isChecked ? WellKnownMemberNames.CheckedDecrementOperatorName : WellKnownMemberNames.DecrementOperatorName;
243
case
UnaryOperatorKind
.True: return WellKnownMemberNames.TrueOperatorName;
244
case
UnaryOperatorKind
.False: return WellKnownMemberNames.FalseOperatorName;
246
throw ExceptionUtilities.UnexpectedValue(kind &
UnaryOperatorKind
.OpMask);
Binder\Semantics\Operators\OperatorKind.cs (36)
294
TypeMask =
UnaryOperatorKind
.TypeMask,
296
Int =
UnaryOperatorKind
.Int,
297
UInt =
UnaryOperatorKind
.UInt,
298
Long =
UnaryOperatorKind
.Long,
299
ULong =
UnaryOperatorKind
.ULong,
300
NInt =
UnaryOperatorKind
.NInt,
301
NUInt =
UnaryOperatorKind
.NUInt,
302
Char =
UnaryOperatorKind
.Char, //not used
303
Float =
UnaryOperatorKind
.Float,
304
Double =
UnaryOperatorKind
.Double,
305
Decimal =
UnaryOperatorKind
.Decimal,
306
Bool =
UnaryOperatorKind
.Bool,
307
Object =
UnaryOperatorKind
._Object,
308
String =
UnaryOperatorKind
._String,
309
StringAndObject =
UnaryOperatorKind
._StringAndObject,
310
ObjectAndString =
UnaryOperatorKind
._ObjectAndString,
312
Enum =
UnaryOperatorKind
.Enum,
313
EnumAndUnderlying =
UnaryOperatorKind
._EnumAndUnderlying,
314
UnderlyingAndEnum =
UnaryOperatorKind
._UnderlyingAndEnum,
315
Delegate =
UnaryOperatorKind
._Delegate,
316
Pointer =
UnaryOperatorKind
.Pointer,
317
PointerAndInt =
UnaryOperatorKind
._PointerAndInt,
318
PointerAndUInt =
UnaryOperatorKind
._PointerAndUInt,
319
PointerAndLong =
UnaryOperatorKind
._PointerAndLong,
320
PointerAndULong =
UnaryOperatorKind
._PointerAndULong,
321
IntAndPointer =
UnaryOperatorKind
._IntAndPointer,
322
UIntAndPointer =
UnaryOperatorKind
._UIntAndPointer,
323
LongAndPointer =
UnaryOperatorKind
._LongAndPointer,
324
ULongAndPointer =
UnaryOperatorKind
._ULongAndPointer,
325
NullableNull =
UnaryOperatorKind
._NullableNull,
326
UserDefined =
UnaryOperatorKind
.UserDefined,
327
Dynamic =
UnaryOperatorKind
.Dynamic,
328
Utf8 =
UnaryOperatorKind
._Utf8,
349
Lifted =
UnaryOperatorKind
.Lifted,
350
Logical =
UnaryOperatorKind
._Logical,
351
Checked =
UnaryOperatorKind
.Checked,
Binder\Semantics\Operators\OperatorKindExtensions.cs (78)
19
public static int OperatorIndex(this
UnaryOperatorKind
kind)
24
public static
UnaryOperatorKind
Operator(this
UnaryOperatorKind
kind)
26
return kind &
UnaryOperatorKind
.OpMask;
29
public static
UnaryOperatorKind
Unlifted(this
UnaryOperatorKind
kind)
31
return kind & ~
UnaryOperatorKind
.Lifted;
34
public static bool IsLifted(this
UnaryOperatorKind
kind)
36
return 0 != (kind &
UnaryOperatorKind
.Lifted);
39
public static bool IsChecked(this
UnaryOperatorKind
kind)
41
return 0 != (kind &
UnaryOperatorKind
.Checked);
44
public static bool IsUserDefined(this
UnaryOperatorKind
kind)
46
return (kind &
UnaryOperatorKind
.TypeMask) ==
UnaryOperatorKind
.UserDefined;
49
public static
UnaryOperatorKind
OverflowChecks(this
UnaryOperatorKind
kind)
51
return kind &
UnaryOperatorKind
.Checked;
54
public static
UnaryOperatorKind
WithOverflowChecksIfApplicable(this
UnaryOperatorKind
kind, bool enabled)
64
return kind |
UnaryOperatorKind
.Checked;
71
case
UnaryOperatorKind
.PrefixIncrement:
72
case
UnaryOperatorKind
.PostfixIncrement:
73
case
UnaryOperatorKind
.PrefixDecrement:
74
case
UnaryOperatorKind
.PostfixDecrement:
75
case
UnaryOperatorKind
.UnaryMinus:
76
return kind |
UnaryOperatorKind
.Checked;
83
return kind & ~
UnaryOperatorKind
.Checked;
87
public static
UnaryOperatorKind
OperandTypes(this
UnaryOperatorKind
kind)
89
return kind &
UnaryOperatorKind
.TypeMask;
92
public static bool IsDynamic(this
UnaryOperatorKind
kind)
94
return kind.OperandTypes() ==
UnaryOperatorKind
.Dynamic;
97
public static bool IsIntegral(this
UnaryOperatorKind
kind)
101
case
UnaryOperatorKind
.SByte:
102
case
UnaryOperatorKind
.Byte:
103
case
UnaryOperatorKind
.Short:
104
case
UnaryOperatorKind
.UShort:
105
case
UnaryOperatorKind
.Int:
106
case
UnaryOperatorKind
.UInt:
107
case
UnaryOperatorKind
.Long:
108
case
UnaryOperatorKind
.ULong:
109
case
UnaryOperatorKind
.NInt:
110
case
UnaryOperatorKind
.NUInt:
111
case
UnaryOperatorKind
.Char:
112
case
UnaryOperatorKind
.Enum:
113
case
UnaryOperatorKind
.Pointer:
120
public static
UnaryOperatorKind
WithType(this
UnaryOperatorKind
kind,
UnaryOperatorKind
type)
122
Debug.Assert(kind == (kind & ~
UnaryOperatorKind
.TypeMask));
123
Debug.Assert(type == (type &
UnaryOperatorKind
.TypeMask));
165
public static
UnaryOperatorKind
WithType(this
UnaryOperatorKind
kind, SpecialType type)
167
Debug.Assert(kind == (kind & ~
UnaryOperatorKind
.TypeMask));
171
return kind |
UnaryOperatorKind
.Int;
173
return kind |
UnaryOperatorKind
.UInt;
175
return kind |
UnaryOperatorKind
.Long;
177
return kind |
UnaryOperatorKind
.ULong;
281
public static bool IsEnum(this
UnaryOperatorKind
kind)
283
return kind.OperandTypes() ==
UnaryOperatorKind
.Enum;
380
public static ExpressionType ToExpressionType(this
UnaryOperatorKind
kind)
384
case
UnaryOperatorKind
.PrefixIncrement:
385
case
UnaryOperatorKind
.PostfixIncrement:
388
case
UnaryOperatorKind
.PostfixDecrement:
389
case
UnaryOperatorKind
.PrefixDecrement:
392
case
UnaryOperatorKind
.UnaryPlus: return ExpressionType.UnaryPlus;
393
case
UnaryOperatorKind
.UnaryMinus: return ExpressionType.Negate;
394
case
UnaryOperatorKind
.LogicalNegation: return ExpressionType.Not;
395
case
UnaryOperatorKind
.BitwiseComplement: return ExpressionType.OnesComplement;
396
case
UnaryOperatorKind
.True: return ExpressionType.IsTrue;
397
case
UnaryOperatorKind
.False: return ExpressionType.IsFalse;
417
public static string Dump(this
UnaryOperatorKind
kind)
420
if ((kind &
UnaryOperatorKind
.Lifted) != 0) b.Append("Lifted");
421
if ((kind &
UnaryOperatorKind
.Checked) != 0) b.Append("Checked");
422
var
type = kind &
UnaryOperatorKind
.TypeMask;
424
var
op = kind &
UnaryOperatorKind
.OpMask;
Binder\Semantics\Operators\UnaryOperatorEasyOut.cs (92)
14
private const
UnaryOperatorKind
ERR =
UnaryOperatorKind
.Error;
16
private const
UnaryOperatorKind
BOL =
UnaryOperatorKind
.Bool;
17
private const
UnaryOperatorKind
CHR =
UnaryOperatorKind
.Char;
18
private const
UnaryOperatorKind
I08 =
UnaryOperatorKind
.SByte;
19
private const
UnaryOperatorKind
U08 =
UnaryOperatorKind
.Byte;
20
private const
UnaryOperatorKind
I16 =
UnaryOperatorKind
.Short;
21
private const
UnaryOperatorKind
U16 =
UnaryOperatorKind
.UShort;
22
private const
UnaryOperatorKind
I32 =
UnaryOperatorKind
.Int;
23
private const
UnaryOperatorKind
U32 =
UnaryOperatorKind
.UInt;
24
private const
UnaryOperatorKind
I64 =
UnaryOperatorKind
.Long;
25
private const
UnaryOperatorKind
U64 =
UnaryOperatorKind
.ULong;
26
private const
UnaryOperatorKind
NIN =
UnaryOperatorKind
.NInt;
27
private const
UnaryOperatorKind
NUI =
UnaryOperatorKind
.NUInt;
28
private const
UnaryOperatorKind
R32 =
UnaryOperatorKind
.Float;
29
private const
UnaryOperatorKind
R64 =
UnaryOperatorKind
.Double;
30
private const
UnaryOperatorKind
DEC =
UnaryOperatorKind
.Decimal;
31
private const
UnaryOperatorKind
LBOL =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.Bool;
32
private const
UnaryOperatorKind
LCHR =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.Char;
33
private const
UnaryOperatorKind
LI08 =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.SByte;
34
private const
UnaryOperatorKind
LU08 =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.Byte;
35
private const
UnaryOperatorKind
LI16 =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.Short;
36
private const
UnaryOperatorKind
LU16 =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.UShort;
37
private const
UnaryOperatorKind
LI32 =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.Int;
38
private const
UnaryOperatorKind
LU32 =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.UInt;
39
private const
UnaryOperatorKind
LI64 =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.Long;
40
private const
UnaryOperatorKind
LU64 =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.ULong;
41
private const
UnaryOperatorKind
LNI =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.NInt;
42
private const
UnaryOperatorKind
LNU =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.NUInt;
43
private const
UnaryOperatorKind
LR32 =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.Float;
44
private const
UnaryOperatorKind
LR64 =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.Double;
45
private const
UnaryOperatorKind
LDEC =
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.Decimal;
47
private static readonly
UnaryOperatorKind
[] s_increment =
52
private static readonly
UnaryOperatorKind
[] s_plus =
57
private static readonly
UnaryOperatorKind
[] s_minus =
62
private static readonly
UnaryOperatorKind
[] s_logicalNegation =
67
private static readonly
UnaryOperatorKind
[] s_bitwiseComplement =
72
private static readonly
UnaryOperatorKind
[][] s_opkind =
84
public static
UnaryOperatorKind
OpKind(
UnaryOperatorKind
kind, TypeSymbol operand)
89
return
UnaryOperatorKind
.Error;
92
var
result = (kindIndex >= s_opkind.Length) ?
UnaryOperatorKind
.Error : s_opkind[kindIndex][index];
93
return result ==
UnaryOperatorKind
.Error ? result : result | kind;
97
private void UnaryOperatorEasyOut(
UnaryOperatorKind
kind, BoundExpression operand, UnaryOperatorOverloadResolutionResult result)
105
var
easyOut = UnopEasyOut.OpKind(kind, operandType);
107
if (easyOut ==
UnaryOperatorKind
.Error)
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (42)
25
UnaryOperatorKind
kind,
74
UnaryOperatorKind
kind,
113
static void getDeclaredUserDefinedUnaryOperatorsInScope(ArrayBuilder<Symbol> extensionCandidatesInSingleScope,
UnaryOperatorKind
kind, string name1, string? name2Opt, ArrayBuilder<UnaryOperatorSignature> operators)
144
static void getDeclaredUserDefinedUnaryOperators(ArrayBuilder<Symbol> extensionCandidatesInSingleScope,
UnaryOperatorKind
kind, string name, ArrayBuilder<UnaryOperatorSignature> operators)
153
void inferTypeArgumentsAndRemoveInapplicableToReceiverType(
UnaryOperatorKind
kind, BoundExpression operand, ArrayBuilder<UnaryOperatorSignature> operators, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
196
inferredCandidate = new UnaryOperatorSignature(
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.UserDefined | kind, MakeNullable(operandType), MakeNullable(resultType), method, constrainedToTypeOpt: null);
200
inferredCandidate = new UnaryOperatorSignature(
UnaryOperatorKind
.UserDefined | kind, operandType, resultType, method, constrainedToTypeOpt: null);
498
private void GetAllBuiltInOperators(
UnaryOperatorKind
kind, bool isChecked, BoundExpression operand, ArrayBuilder<UnaryOperatorAnalysisResult> results, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
549
private void GetEnumOperations(
UnaryOperatorKind
kind, BoundExpression operand, ArrayBuilder<UnaryOperatorSignature> operators)
569
case
UnaryOperatorKind
.PostfixIncrement:
570
case
UnaryOperatorKind
.PostfixDecrement:
571
case
UnaryOperatorKind
.PrefixIncrement:
572
case
UnaryOperatorKind
.PrefixDecrement:
573
case
UnaryOperatorKind
.BitwiseComplement:
574
operators.Add(new UnaryOperatorSignature(kind |
UnaryOperatorKind
.Enum, enumType, enumType));
575
operators.Add(new UnaryOperatorSignature(kind |
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.Enum, nullableEnum, nullableEnum));
580
private static UnaryOperatorSignature? GetPointerOperation(
UnaryOperatorKind
kind, BoundExpression operand)
593
case
UnaryOperatorKind
.PostfixIncrement:
594
case
UnaryOperatorKind
.PostfixDecrement:
595
case
UnaryOperatorKind
.PrefixIncrement:
596
case
UnaryOperatorKind
.PrefixDecrement:
597
op = new UnaryOperatorSignature(kind |
UnaryOperatorKind
.Pointer, pointerType, pointerType);
605
UnaryOperatorKind
kind,
651
UnaryOperatorKind
kind,
753
internal static void GetStaticUserDefinedUnaryOperatorMethodNames(
UnaryOperatorKind
kind, bool isChecked, out string name1, out string? name2Opt)
770
UnaryOperatorKind
kind,
809
private static void GetDeclaredUserDefinedUnaryOperators(TypeSymbol? constrainedToTypeOpt, NamedTypeSymbol type,
UnaryOperatorKind
kind, string name, ArrayBuilder<UnaryOperatorSignature> operators)
817
private static void GetDeclaredUserDefinedUnaryOperators(TypeSymbol? constrainedToTypeOpt, IEnumerable<MethodSymbol> typeOperators,
UnaryOperatorKind
kind, string name, ArrayBuilder<UnaryOperatorSignature> operators)
835
operators.Add(new UnaryOperatorSignature(
UnaryOperatorKind
.UserDefined | kind, operandType, resultType, op, constrainedToTypeOpt));
839
private void AddLiftedUserDefinedUnaryOperators(TypeSymbol? constrainedToTypeOpt,
UnaryOperatorKind
kind, ArrayBuilder<UnaryOperatorSignature> operators)
847
case
UnaryOperatorKind
.UnaryPlus:
848
case
UnaryOperatorKind
.PrefixDecrement:
849
case
UnaryOperatorKind
.PrefixIncrement:
850
case
UnaryOperatorKind
.UnaryMinus:
851
case
UnaryOperatorKind
.PostfixDecrement:
852
case
UnaryOperatorKind
.PostfixIncrement:
853
case
UnaryOperatorKind
.LogicalNegation:
854
case
UnaryOperatorKind
.BitwiseComplement:
866
UnaryOperatorKind
.Lifted |
UnaryOperatorKind
.UserDefined | kind,
Binder\Semantics\Operators\UnaryOperatorSignature.cs (3)
21
public readonly
UnaryOperatorKind
Kind;
23
public UnaryOperatorSignature(
UnaryOperatorKind
kind, TypeSymbol operandType, TypeSymbol returnType)
32
public UnaryOperatorSignature(
UnaryOperatorKind
kind, TypeSymbol operandType, TypeSymbol returnType, MethodSymbol method, TypeSymbol constrainedToTypeOpt)
BoundTree\Constructors.cs (4)
680
UnaryOperatorKind
operatorKind,
692
public BoundUnaryOperator Update(
UnaryOperatorKind
operatorKind,
706
UnaryOperatorKind
operatorKind,
721
public BoundIncrementOperator Update(
UnaryOperatorKind
operatorKind, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, BoundValuePlaceholder? operandPlaceholder, BoundExpression? operandConversion, BoundValuePlaceholder? resultPlaceholder, BoundExpression? resultConversion, LookupResultKind resultKind, TypeSymbol type)
CodeGen\EmitOperators.cs (13)
19
var
operatorKind = expression.OperatorKind;
33
if (operatorKind ==
UnaryOperatorKind
.BoolLogicalNegation)
42
case
UnaryOperatorKind
.UnaryMinus:
46
case
UnaryOperatorKind
.BitwiseComplement:
50
case
UnaryOperatorKind
.UnaryPlus:
575
Debug.Assert(unOp.OperatorKind ==
UnaryOperatorKind
.BoolLogicalNegation);
583
Debug.Assert(expression.OperatorKind.Operator() ==
UnaryOperatorKind
.UnaryMinus);
584
var
type = expression.OperatorKind.OperandTypes();
596
Debug.Assert(type ==
UnaryOperatorKind
.Int || type ==
UnaryOperatorKind
.Long || type ==
UnaryOperatorKind
.NInt);
605
if (type ==
UnaryOperatorKind
.Long)
609
else if (type ==
UnaryOperatorKind
.NInt)
CodeGen\EmitStatement.cs (1)
577
if (unOp.OperatorKind ==
UnaryOperatorKind
.BoolLogicalNegation)
CodeGen\Optimizer.cs (1)
1666
if (node.OperatorKind.IsChecked() && node.OperatorKind.Operator() ==
UnaryOperatorKind
.UnaryMinus)
Compilation\BuiltInOperators.cs (176)
44
builder.Add(GetSignature((
UnaryOperatorKind
)kind));
50
internal void GetSimpleBuiltInOperators(
UnaryOperatorKind
kind, ArrayBuilder<UnaryOperatorSignature> operators, bool skipNativeIntegerOperators)
58
(int)
UnaryOperatorKind
.SBytePostfixIncrement,
59
(int)
UnaryOperatorKind
.BytePostfixIncrement,
60
(int)
UnaryOperatorKind
.ShortPostfixIncrement,
61
(int)
UnaryOperatorKind
.UShortPostfixIncrement,
62
(int)
UnaryOperatorKind
.IntPostfixIncrement,
63
(int)
UnaryOperatorKind
.UIntPostfixIncrement,
64
(int)
UnaryOperatorKind
.LongPostfixIncrement,
65
(int)
UnaryOperatorKind
.ULongPostfixIncrement,
66
(int)
UnaryOperatorKind
.NIntPostfixIncrement,
67
(int)
UnaryOperatorKind
.NUIntPostfixIncrement,
68
(int)
UnaryOperatorKind
.CharPostfixIncrement,
69
(int)
UnaryOperatorKind
.FloatPostfixIncrement,
70
(int)
UnaryOperatorKind
.DoublePostfixIncrement,
71
(int)
UnaryOperatorKind
.DecimalPostfixIncrement,
72
(int)
UnaryOperatorKind
.LiftedSBytePostfixIncrement,
73
(int)
UnaryOperatorKind
.LiftedBytePostfixIncrement,
74
(int)
UnaryOperatorKind
.LiftedShortPostfixIncrement,
75
(int)
UnaryOperatorKind
.LiftedUShortPostfixIncrement,
76
(int)
UnaryOperatorKind
.LiftedIntPostfixIncrement,
77
(int)
UnaryOperatorKind
.LiftedUIntPostfixIncrement,
78
(int)
UnaryOperatorKind
.LiftedLongPostfixIncrement,
79
(int)
UnaryOperatorKind
.LiftedULongPostfixIncrement,
80
(int)
UnaryOperatorKind
.LiftedNIntPostfixIncrement,
81
(int)
UnaryOperatorKind
.LiftedNUIntPostfixIncrement,
82
(int)
UnaryOperatorKind
.LiftedCharPostfixIncrement,
83
(int)
UnaryOperatorKind
.LiftedFloatPostfixIncrement,
84
(int)
UnaryOperatorKind
.LiftedDoublePostfixIncrement,
85
(int)
UnaryOperatorKind
.LiftedDecimalPostfixIncrement,
89
(int)
UnaryOperatorKind
.SBytePostfixDecrement,
90
(int)
UnaryOperatorKind
.BytePostfixDecrement,
91
(int)
UnaryOperatorKind
.ShortPostfixDecrement,
92
(int)
UnaryOperatorKind
.UShortPostfixDecrement,
93
(int)
UnaryOperatorKind
.IntPostfixDecrement,
94
(int)
UnaryOperatorKind
.UIntPostfixDecrement,
95
(int)
UnaryOperatorKind
.LongPostfixDecrement,
96
(int)
UnaryOperatorKind
.ULongPostfixDecrement,
97
(int)
UnaryOperatorKind
.NIntPostfixDecrement,
98
(int)
UnaryOperatorKind
.NUIntPostfixDecrement,
99
(int)
UnaryOperatorKind
.CharPostfixDecrement,
100
(int)
UnaryOperatorKind
.FloatPostfixDecrement,
101
(int)
UnaryOperatorKind
.DoublePostfixDecrement,
102
(int)
UnaryOperatorKind
.DecimalPostfixDecrement,
103
(int)
UnaryOperatorKind
.LiftedSBytePostfixDecrement,
104
(int)
UnaryOperatorKind
.LiftedBytePostfixDecrement,
105
(int)
UnaryOperatorKind
.LiftedShortPostfixDecrement,
106
(int)
UnaryOperatorKind
.LiftedUShortPostfixDecrement,
107
(int)
UnaryOperatorKind
.LiftedIntPostfixDecrement,
108
(int)
UnaryOperatorKind
.LiftedUIntPostfixDecrement,
109
(int)
UnaryOperatorKind
.LiftedLongPostfixDecrement,
110
(int)
UnaryOperatorKind
.LiftedULongPostfixDecrement,
111
(int)
UnaryOperatorKind
.LiftedNIntPostfixDecrement,
112
(int)
UnaryOperatorKind
.LiftedNUIntPostfixDecrement,
113
(int)
UnaryOperatorKind
.LiftedCharPostfixDecrement,
114
(int)
UnaryOperatorKind
.LiftedFloatPostfixDecrement,
115
(int)
UnaryOperatorKind
.LiftedDoublePostfixDecrement,
116
(int)
UnaryOperatorKind
.LiftedDecimalPostfixDecrement,
120
(int)
UnaryOperatorKind
.SBytePrefixIncrement,
121
(int)
UnaryOperatorKind
.BytePrefixIncrement,
122
(int)
UnaryOperatorKind
.ShortPrefixIncrement,
123
(int)
UnaryOperatorKind
.UShortPrefixIncrement,
124
(int)
UnaryOperatorKind
.IntPrefixIncrement,
125
(int)
UnaryOperatorKind
.UIntPrefixIncrement,
126
(int)
UnaryOperatorKind
.LongPrefixIncrement,
127
(int)
UnaryOperatorKind
.ULongPrefixIncrement,
128
(int)
UnaryOperatorKind
.NIntPrefixIncrement,
129
(int)
UnaryOperatorKind
.NUIntPrefixIncrement,
130
(int)
UnaryOperatorKind
.CharPrefixIncrement,
131
(int)
UnaryOperatorKind
.FloatPrefixIncrement,
132
(int)
UnaryOperatorKind
.DoublePrefixIncrement,
133
(int)
UnaryOperatorKind
.DecimalPrefixIncrement,
134
(int)
UnaryOperatorKind
.LiftedSBytePrefixIncrement,
135
(int)
UnaryOperatorKind
.LiftedBytePrefixIncrement,
136
(int)
UnaryOperatorKind
.LiftedShortPrefixIncrement,
137
(int)
UnaryOperatorKind
.LiftedUShortPrefixIncrement,
138
(int)
UnaryOperatorKind
.LiftedIntPrefixIncrement,
139
(int)
UnaryOperatorKind
.LiftedUIntPrefixIncrement,
140
(int)
UnaryOperatorKind
.LiftedLongPrefixIncrement,
141
(int)
UnaryOperatorKind
.LiftedULongPrefixIncrement,
142
(int)
UnaryOperatorKind
.LiftedNIntPrefixIncrement,
143
(int)
UnaryOperatorKind
.LiftedNUIntPrefixIncrement,
144
(int)
UnaryOperatorKind
.LiftedCharPrefixIncrement,
145
(int)
UnaryOperatorKind
.LiftedFloatPrefixIncrement,
146
(int)
UnaryOperatorKind
.LiftedDoublePrefixIncrement,
147
(int)
UnaryOperatorKind
.LiftedDecimalPrefixIncrement,
151
(int)
UnaryOperatorKind
.SBytePrefixDecrement,
152
(int)
UnaryOperatorKind
.BytePrefixDecrement,
153
(int)
UnaryOperatorKind
.ShortPrefixDecrement,
154
(int)
UnaryOperatorKind
.UShortPrefixDecrement,
155
(int)
UnaryOperatorKind
.IntPrefixDecrement,
156
(int)
UnaryOperatorKind
.UIntPrefixDecrement,
157
(int)
UnaryOperatorKind
.NIntPrefixDecrement,
158
(int)
UnaryOperatorKind
.NUIntPrefixDecrement,
159
(int)
UnaryOperatorKind
.LongPrefixDecrement,
160
(int)
UnaryOperatorKind
.ULongPrefixDecrement,
161
(int)
UnaryOperatorKind
.CharPrefixDecrement,
162
(int)
UnaryOperatorKind
.FloatPrefixDecrement,
163
(int)
UnaryOperatorKind
.DoublePrefixDecrement,
164
(int)
UnaryOperatorKind
.DecimalPrefixDecrement,
165
(int)
UnaryOperatorKind
.LiftedSBytePrefixDecrement,
166
(int)
UnaryOperatorKind
.LiftedBytePrefixDecrement,
167
(int)
UnaryOperatorKind
.LiftedShortPrefixDecrement,
168
(int)
UnaryOperatorKind
.LiftedUShortPrefixDecrement,
169
(int)
UnaryOperatorKind
.LiftedIntPrefixDecrement,
170
(int)
UnaryOperatorKind
.LiftedUIntPrefixDecrement,
171
(int)
UnaryOperatorKind
.LiftedLongPrefixDecrement,
172
(int)
UnaryOperatorKind
.LiftedULongPrefixDecrement,
173
(int)
UnaryOperatorKind
.LiftedNIntPrefixDecrement,
174
(int)
UnaryOperatorKind
.LiftedNUIntPrefixDecrement,
175
(int)
UnaryOperatorKind
.LiftedCharPrefixDecrement,
176
(int)
UnaryOperatorKind
.LiftedFloatPrefixDecrement,
177
(int)
UnaryOperatorKind
.LiftedDoublePrefixDecrement,
178
(int)
UnaryOperatorKind
.LiftedDecimalPrefixDecrement,
182
(int)
UnaryOperatorKind
.IntUnaryPlus,
183
(int)
UnaryOperatorKind
.UIntUnaryPlus,
184
(int)
UnaryOperatorKind
.LongUnaryPlus,
185
(int)
UnaryOperatorKind
.ULongUnaryPlus,
186
(int)
UnaryOperatorKind
.NIntUnaryPlus,
187
(int)
UnaryOperatorKind
.NUIntUnaryPlus,
188
(int)
UnaryOperatorKind
.FloatUnaryPlus,
189
(int)
UnaryOperatorKind
.DoubleUnaryPlus,
190
(int)
UnaryOperatorKind
.DecimalUnaryPlus,
191
(int)
UnaryOperatorKind
.LiftedIntUnaryPlus,
192
(int)
UnaryOperatorKind
.LiftedUIntUnaryPlus,
193
(int)
UnaryOperatorKind
.LiftedLongUnaryPlus,
194
(int)
UnaryOperatorKind
.LiftedULongUnaryPlus,
195
(int)
UnaryOperatorKind
.LiftedNIntUnaryPlus,
196
(int)
UnaryOperatorKind
.LiftedNUIntUnaryPlus,
197
(int)
UnaryOperatorKind
.LiftedFloatUnaryPlus,
198
(int)
UnaryOperatorKind
.LiftedDoubleUnaryPlus,
199
(int)
UnaryOperatorKind
.LiftedDecimalUnaryPlus,
203
(int)
UnaryOperatorKind
.IntUnaryMinus,
204
(int)
UnaryOperatorKind
.LongUnaryMinus,
205
(int)
UnaryOperatorKind
.NIntUnaryMinus,
206
(int)
UnaryOperatorKind
.FloatUnaryMinus,
207
(int)
UnaryOperatorKind
.DoubleUnaryMinus,
208
(int)
UnaryOperatorKind
.DecimalUnaryMinus,
209
(int)
UnaryOperatorKind
.LiftedIntUnaryMinus,
210
(int)
UnaryOperatorKind
.LiftedLongUnaryMinus,
211
(int)
UnaryOperatorKind
.LiftedNIntUnaryMinus,
212
(int)
UnaryOperatorKind
.LiftedFloatUnaryMinus,
213
(int)
UnaryOperatorKind
.LiftedDoubleUnaryMinus,
214
(int)
UnaryOperatorKind
.LiftedDecimalUnaryMinus,
218
(int)
UnaryOperatorKind
.BoolLogicalNegation,
219
(int)
UnaryOperatorKind
.LiftedBoolLogicalNegation,
223
(int)
UnaryOperatorKind
.IntBitwiseComplement,
224
(int)
UnaryOperatorKind
.UIntBitwiseComplement,
225
(int)
UnaryOperatorKind
.LongBitwiseComplement,
226
(int)
UnaryOperatorKind
.ULongBitwiseComplement,
227
(int)
UnaryOperatorKind
.NIntBitwiseComplement,
228
(int)
UnaryOperatorKind
.NUIntBitwiseComplement,
229
(int)
UnaryOperatorKind
.LiftedIntBitwiseComplement,
230
(int)
UnaryOperatorKind
.LiftedUIntBitwiseComplement,
231
(int)
UnaryOperatorKind
.LiftedLongBitwiseComplement,
232
(int)
UnaryOperatorKind
.LiftedULongBitwiseComplement,
233
(int)
UnaryOperatorKind
.LiftedNIntBitwiseComplement,
234
(int)
UnaryOperatorKind
.LiftedNUIntBitwiseComplement,
250
case
UnaryOperatorKind
.NInt:
251
case
UnaryOperatorKind
.NUInt:
259
internal UnaryOperatorSignature GetSignature(
UnaryOperatorKind
kind)
264
case
UnaryOperatorKind
.SByte: opType = _compilation.GetSpecialType(SpecialType.System_SByte); break;
265
case
UnaryOperatorKind
.Byte: opType = _compilation.GetSpecialType(SpecialType.System_Byte); break;
266
case
UnaryOperatorKind
.Short: opType = _compilation.GetSpecialType(SpecialType.System_Int16); break;
267
case
UnaryOperatorKind
.UShort: opType = _compilation.GetSpecialType(SpecialType.System_UInt16); break;
268
case
UnaryOperatorKind
.Int: opType = _compilation.GetSpecialType(SpecialType.System_Int32); break;
269
case
UnaryOperatorKind
.UInt: opType = _compilation.GetSpecialType(SpecialType.System_UInt32); break;
270
case
UnaryOperatorKind
.Long: opType = _compilation.GetSpecialType(SpecialType.System_Int64); break;
271
case
UnaryOperatorKind
.ULong: opType = _compilation.GetSpecialType(SpecialType.System_UInt64); break;
272
case
UnaryOperatorKind
.NInt: opType = _compilation.CreateNativeIntegerTypeSymbol(signed: true); break;
273
case
UnaryOperatorKind
.NUInt: opType = _compilation.CreateNativeIntegerTypeSymbol(signed: false); break;
274
case
UnaryOperatorKind
.Char: opType = _compilation.GetSpecialType(SpecialType.System_Char); break;
275
case
UnaryOperatorKind
.Float: opType = _compilation.GetSpecialType(SpecialType.System_Single); break;
276
case
UnaryOperatorKind
.Double: opType = _compilation.GetSpecialType(SpecialType.System_Double); break;
277
case
UnaryOperatorKind
.Decimal: opType = _compilation.GetSpecialType(SpecialType.System_Decimal); break;
278
case
UnaryOperatorKind
.Bool: opType = _compilation.GetSpecialType(SpecialType.System_Boolean); break;
Compilation\CSharpCompilation.cs (8)
4604
var
unaryKind = Binder.SyntaxKindToUnaryOperatorKind(SyntaxFacts.GetPrefixUnaryExpression(syntaxKind));
4609
var
easyOutUnaryKind = OverloadResolution.UnopEasyOut.OpKind(unaryKind, csharpOperandType);
4611
if (easyOutUnaryKind !=
UnaryOperatorKind
.Error)
4625
unaryKind is
UnaryOperatorKind
.PrefixIncrement or
UnaryOperatorKind
.PrefixDecrement or
UnaryOperatorKind
.BitwiseComplement &&
4633
unaryKind is
UnaryOperatorKind
.PrefixIncrement or
UnaryOperatorKind
.PrefixDecrement &&
Compilation\CSharpSemanticModel.cs (6)
3802
UnaryOperatorKind
operandType = unaryOperator.OperatorKind.OperandTypes();
3805
if (operandType == 0 || operandType ==
UnaryOperatorKind
.UserDefined || unaryOperator.ResultKind != LookupResultKind.Viable)
3815
UnaryOperatorKind
op = unaryOperator.OperatorKind.Operator();
3825
UnaryOperatorKind
operandType = increment.OperatorKind.OperandTypes();
3828
if (operandType == 0 || operandType ==
UnaryOperatorKind
.UserDefined || increment.ResultKind != LookupResultKind.Viable)
3838
UnaryOperatorKind
op = increment.OperatorKind.Operator();
FlowAnalysis\AbstractFlowPass.cs (1)
2789
if (node.OperatorKind ==
UnaryOperatorKind
.BoolLogicalNegation)
FlowAnalysis\NullableWalker.cs (6)
11244
var
op = node.OperatorKind.Operator();
11245
TypeWithState resultType = (op ==
UnaryOperatorKind
.PrefixIncrement || op ==
UnaryOperatorKind
.PrefixDecrement) ? resultOfIncrementType : operandType;
12083
case
UnaryOperatorKind
.BoolLogicalNegation:
12089
case
UnaryOperatorKind
.DynamicTrue:
12095
case
UnaryOperatorKind
.DynamicLogicalNegation:
Generated\BoundNodes.xml.Generated.cs (6)
1164
public BoundUnaryOperator(SyntaxNode syntax,
UnaryOperatorKind
operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false)
1181
public
UnaryOperatorKind
OperatorKind { get; }
1192
public BoundUnaryOperator Update(
UnaryOperatorKind
operatorKind, BoundExpression operand, ConstantValue? constantValueOpt, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
1206
public BoundIncrementOperator(SyntaxNode syntax,
UnaryOperatorKind
operatorKind, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, BoundValuePlaceholder? operandPlaceholder, BoundExpression? operandConversion, BoundValuePlaceholder? resultPlaceholder, BoundExpression? resultConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type, bool hasErrors = false)
1226
public
UnaryOperatorKind
OperatorKind { get; }
1240
public BoundIncrementOperator Update(
UnaryOperatorKind
operatorKind, BoundExpression operand, MethodSymbol? methodOpt, TypeSymbol? constrainedToTypeOpt, BoundValuePlaceholder? operandPlaceholder, BoundExpression? operandConversion, BoundValuePlaceholder? resultPlaceholder, BoundExpression? resultConversion, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, TypeSymbol type)
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (10)
1138
var
opKind = node.OperatorKind;
1139
var
op = opKind &
UnaryOperatorKind
.OpMask;
1140
var isChecked = (opKind &
UnaryOperatorKind
.Checked) != 0;
1145
case
UnaryOperatorKind
.UnaryPlus:
1152
case
UnaryOperatorKind
.UnaryMinus:
1157
case
UnaryOperatorKind
.BitwiseComplement:
1158
case
UnaryOperatorKind
.LogicalNegation:
1186
if (node.OperatorKind.OperandTypes() ==
UnaryOperatorKind
.Enum && (opKind &
UnaryOperatorKind
.Lifted) != 0)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (19)
343
return MakeUnaryOperator(
UnaryOperatorKind
.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredRight, loweredRight.Type);
346
return MakeUnaryOperator(
UnaryOperatorKind
.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredLeft, loweredLeft.Type);
357
return MakeUnaryOperator(
UnaryOperatorKind
.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredRight, loweredRight.Type);
360
return MakeUnaryOperator(
UnaryOperatorKind
.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredLeft, loweredLeft.Type);
371
return MakeUnaryOperator(
UnaryOperatorKind
.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredRight, loweredRight.Type);
374
return MakeUnaryOperator(
UnaryOperatorKind
.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredLeft, loweredLeft.Type);
628
var
testOperator = isAnd ?
UnaryOperatorKind
.DynamicFalse :
UnaryOperatorKind
.DynamicTrue;
634
if (testOperator ==
UnaryOperatorKind
.DynamicFalse && constantLeft == ConstantValue.False ||
635
testOperator ==
UnaryOperatorKind
.DynamicTrue && constantLeft == ConstantValue.True)
677
bool leftTestIsConstantFalse = testOperator ==
UnaryOperatorKind
.DynamicFalse && constantLeft == ConstantValue.True ||
678
testOperator ==
UnaryOperatorKind
.DynamicTrue && constantLeft == ConstantValue.False;
738
return _dynamicFactory.MakeDynamicUnaryOperator(negative ?
UnaryOperatorKind
.DynamicFalse :
UnaryOperatorKind
.DynamicTrue, loweredLeft, boolean).ToExpression();
757
return new BoundUnaryOperator(syntax,
UnaryOperatorKind
.BoolLogicalNegation, converted, ConstantValue.NotAvailable, MethodSymbol.None, constrainedToTypeOpt: null, LookupResultKind.Viable, boolean)
893
MakeUnaryOperator(
UnaryOperatorKind
.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, callHasValue, boolType) :
1876
BoundExpression invert = MakeUnaryOperator(
UnaryOperatorKind
.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, innerOr, boolType);
2009
new BoundUnaryOperator(syntax,
UnaryOperatorKind
.BoolLogicalNegation, call, ConstantValue.NotAvailable, null, constrainedToTypeOpt: null, LookupResultKind.Viable, returnType);
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (3)
558
return _factory.Not(MakeUnaryOperator(
UnaryOperatorKind
.DynamicFalse, left.Syntax, method: null, constrainedToTypeOpt: null, dynamicResult, boolType));
562
return MakeUnaryOperator(
UnaryOperatorKind
.DynamicTrue, left.Syntax, method: null, constrainedToTypeOpt: null, dynamicResult, boolType);
578
if (boolOperator.Kind !=
UnaryOperatorKind
.Error)
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (67)
34
case
UnaryOperatorKind
.PrefixDecrement:
35
case
UnaryOperatorKind
.PrefixIncrement:
36
case
UnaryOperatorKind
.PostfixDecrement:
37
case
UnaryOperatorKind
.PostfixIncrement:
52
if (node.OperatorKind ==
UnaryOperatorKind
.DynamicTrue && binaryOperator.OperatorKind == BinaryOperatorKind.DynamicLogicalOr ||
53
node.OperatorKind ==
UnaryOperatorKind
.DynamicFalse && binaryOperator.OperatorKind == BinaryOperatorKind.DynamicLogicalAnd)
64
UnaryOperatorKind
kind,
76
UnaryOperatorKind
kind,
85
Debug.Assert((kind ==
UnaryOperatorKind
.DynamicTrue || kind ==
UnaryOperatorKind
.DynamicFalse) && type.SpecialType == SpecialType.System_Boolean
95
case
UnaryOperatorKind
.DynamicTrue:
97
case
UnaryOperatorKind
.DynamicLogicalNegation:
115
if (!_inExpressionLambda || kind ==
UnaryOperatorKind
.UserDefinedTrue || kind ==
UnaryOperatorKind
.UserDefinedFalse)
125
else if (kind.Operator() ==
UnaryOperatorKind
.UnaryPlus)
131
if (kind ==
UnaryOperatorKind
.EnumBitwiseComplement)
141
UnaryOperatorKind
newKind = kind.Operator().WithType(upconvertSpecialType);
165
if (kind ==
UnaryOperatorKind
.DecimalUnaryMinus)
180
UnaryOperatorKind
kind,
244
UnaryOperatorKind
operatorKind,
354
private BoundExpression GetLiftedUnaryOperatorConsequence(
UnaryOperatorKind
kind, SyntaxNode syntax, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt, TypeSymbol type, BoundExpression nonNullOperand)
378
var
op = node.OperatorKind.Operator();
379
return op ==
UnaryOperatorKind
.PostfixIncrement || op ==
UnaryOperatorKind
.PrefixIncrement;
384
var
op = node.OperatorKind.Operator();
385
return op ==
UnaryOperatorKind
.PrefixIncrement || op ==
UnaryOperatorKind
.PrefixDecrement;
736
if (node.OperatorKind.OperandTypes() ==
UnaryOperatorKind
.UserDefined)
928
if (node.OperatorKind.OperandTypes() ==
UnaryOperatorKind
.Pointer)
1058
UnaryOperatorKind
kind = node.OperatorKind.OperandTypes();
1063
if (kind ==
UnaryOperatorKind
.Enum)
1072
case
UnaryOperatorKind
.Int:
1075
case
UnaryOperatorKind
.SByte:
1078
case
UnaryOperatorKind
.Short:
1081
case
UnaryOperatorKind
.Byte:
1084
case
UnaryOperatorKind
.UShort:
1087
case
UnaryOperatorKind
.Char:
1090
case
UnaryOperatorKind
.UInt:
1093
case
UnaryOperatorKind
.Long:
1096
case
UnaryOperatorKind
.ULong:
1099
case
UnaryOperatorKind
.NInt:
1102
case
UnaryOperatorKind
.NUInt:
1105
case
UnaryOperatorKind
.Float:
1108
case
UnaryOperatorKind
.Double:
1111
case
UnaryOperatorKind
.Decimal:
1114
case
UnaryOperatorKind
.Pointer:
1116
case
UnaryOperatorKind
.UserDefined:
1117
case
UnaryOperatorKind
.Bool:
1138
UnaryOperatorKind
unaryOperatorKind = node.OperatorKind;
1143
case
UnaryOperatorKind
.Int:
1144
case
UnaryOperatorKind
.SByte:
1145
case
UnaryOperatorKind
.Short:
1148
case
UnaryOperatorKind
.Byte:
1149
case
UnaryOperatorKind
.UShort:
1150
case
UnaryOperatorKind
.Char:
1151
case
UnaryOperatorKind
.UInt:
1154
case
UnaryOperatorKind
.Long:
1157
case
UnaryOperatorKind
.ULong:
1160
case
UnaryOperatorKind
.NInt:
1163
case
UnaryOperatorKind
.NUInt:
1166
case
UnaryOperatorKind
.Float:
1169
case
UnaryOperatorKind
.Double:
1172
case
UnaryOperatorKind
.Decimal: //Dev10 special cased this, but we'll let DecimalRewriter handle it
1175
case
UnaryOperatorKind
.Enum:
1213
case
UnaryOperatorKind
.Pointer:
1216
case
UnaryOperatorKind
.UserDefined:
1217
case
UnaryOperatorKind
.Bool:
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (1)
116
UnaryOperatorKind
operatorKind,
Lowering\SyntheticBoundNodeFactory.cs (2)
1641
return new BoundUnaryOperator(expression.Syntax,
UnaryOperatorKind
.BoolLogicalNegation, expression, null, null, constrainedToTypeOpt: null, LookupResultKind.Viable, expression.Type);
1888
new BoundUnaryOperator(syntax,
UnaryOperatorKind
.BoolLogicalNegation, call, ConstantValue.NotAvailable, methodOpt: null, constrainedToTypeOpt: null, LookupResultKind.Viable, returnType);
Operations\CSharpOperationFactory_Methods.cs (13)
495
internal static bool IsPostfixIncrementOrDecrement(CSharp.
UnaryOperatorKind
operatorKind)
499
case CSharp.
UnaryOperatorKind
.PostfixIncrement:
500
case CSharp.
UnaryOperatorKind
.PostfixDecrement:
508
internal static bool IsDecrement(CSharp.
UnaryOperatorKind
operatorKind)
512
case CSharp.
UnaryOperatorKind
.PrefixDecrement:
513
case CSharp.
UnaryOperatorKind
.PostfixDecrement:
521
internal static UnaryOperatorKind DeriveUnaryOperatorKind(CSharp.
UnaryOperatorKind
operatorKind)
525
case CSharp.
UnaryOperatorKind
.UnaryPlus:
528
case CSharp.
UnaryOperatorKind
.UnaryMinus:
531
case CSharp.
UnaryOperatorKind
.LogicalNegation:
534
case CSharp.
UnaryOperatorKind
.BitwiseComplement:
537
case CSharp.
UnaryOperatorKind
.True:
540
case CSharp.
UnaryOperatorKind
.False:
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (10)
Emit\NumericIntPtrTests.cs (10)
1535
UnaryOperatorKind
.PostfixIncrement,
1536
UnaryOperatorKind
.PostfixDecrement,
1537
UnaryOperatorKind
.PrefixIncrement,
1538
UnaryOperatorKind
.PrefixDecrement,
1539
UnaryOperatorKind
.UnaryPlus,
1540
UnaryOperatorKind
.UnaryMinus,
1541
UnaryOperatorKind
.BitwiseComplement,
1565
foreach (
var
operatorKind in unaryOperators)
1577
static void verifyUnaryOperators(CSharpCompilation comp,
UnaryOperatorKind
operatorKind, bool skipNativeIntegerOperators)
1583
int expectedUnsigned = skipNativeIntegerOperators ? 0 : (operatorKind ==
UnaryOperatorKind
.UnaryMinus) ? 0 : 1;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (42)
Semantics\NativeIntegerTests.cs (10)
4775
UnaryOperatorKind
.PostfixIncrement,
4776
UnaryOperatorKind
.PostfixDecrement,
4777
UnaryOperatorKind
.PrefixIncrement,
4778
UnaryOperatorKind
.PrefixDecrement,
4779
UnaryOperatorKind
.UnaryPlus,
4780
UnaryOperatorKind
.UnaryMinus,
4781
UnaryOperatorKind
.BitwiseComplement,
4805
foreach (
var
operatorKind in unaryOperators)
4817
static void verifyUnaryOperators(CSharpCompilation comp,
UnaryOperatorKind
operatorKind, bool skipNativeIntegerOperators)
4823
int expectedUnsigned = skipNativeIntegerOperators ? 0 : (operatorKind ==
UnaryOperatorKind
.UnaryMinus) ? 0 : 1;
Semantics\OperatorTests.cs (32)
7398
UnaryOperatorKind
[] operators =
7400
UnaryOperatorKind
.PostfixIncrement,
7401
UnaryOperatorKind
.PostfixDecrement,
7402
UnaryOperatorKind
.PrefixIncrement,
7403
UnaryOperatorKind
.PrefixDecrement,
7404
UnaryOperatorKind
.UnaryPlus,
7405
UnaryOperatorKind
.UnaryMinus,
7406
UnaryOperatorKind
.LogicalNegation,
7407
UnaryOperatorKind
.BitwiseComplement
7455
if (operators[k] ==
UnaryOperatorKind
.PostfixDecrement || operators[k] ==
UnaryOperatorKind
.PostfixIncrement)
7511
foreach (
var
op in operators)
7530
UnaryOperatorKind
op,
7564
if (op ==
UnaryOperatorKind
.BitwiseComplement ||
7565
op ==
UnaryOperatorKind
.PrefixDecrement || op ==
UnaryOperatorKind
.PrefixIncrement ||
7566
op ==
UnaryOperatorKind
.PostfixDecrement || op ==
UnaryOperatorKind
.PostfixIncrement)
7571
UnaryOperatorKind
result = OverloadResolution.UnopEasyOut.OpKind(op, underlying);
7574
if (result ==
UnaryOperatorKind
.Error)
7578
signature = new UnaryOperatorSignature(op |
UnaryOperatorKind
.Dynamic, type, type);
7581
(op ==
UnaryOperatorKind
.PrefixDecrement || op ==
UnaryOperatorKind
.PrefixIncrement ||
7582
op ==
UnaryOperatorKind
.PostfixDecrement || op ==
UnaryOperatorKind
.PostfixIncrement))
7584
signature = new UnaryOperatorSignature(op |
UnaryOperatorKind
.Pointer, type, type);
7613
if (op ==
UnaryOperatorKind
.LogicalNegation && type.IsEnumType())
7630
case
UnaryOperatorKind
.UnaryMinus:
7634
case
UnaryOperatorKind
.PrefixDecrement:
7635
case
UnaryOperatorKind
.PrefixIncrement:
7636
case
UnaryOperatorKind
.PostfixDecrement:
7637
case
UnaryOperatorKind
.PostfixIncrement: