211 references to BetterResult
Microsoft.CodeAnalysis.CSharp (211)
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (16)
730
return
BetterResult
.Equal;
737
return
BetterResult
.Neither;
739
return leftWins ?
BetterResult
.Left :
BetterResult
.Right;
769
return
BetterResult
.Equal;
776
return
BetterResult
.Neither;
778
return leftWins ?
BetterResult
.Left :
BetterResult
.Right;
799
private static int? UniqueBestValidIndex<T>(ImmutableArray<T> items, Func<T, bool> valid, Func<T, T,
BetterResult
> better)
824
BetterResult
result = better(candidateItem, currentItem);
826
if (result ==
BetterResult
.Equal)
831
else if (result ==
BetterResult
.Neither)
839
else if (result ==
BetterResult
.Right)
866
BetterResult
result = better(candidateItem, currentItem);
867
if (result !=
BetterResult
.Left && result !=
BetterResult
.Equal)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (40)
1112
var
better = BetterOperator(candidates[i].Signature, candidates[j].Signature, left, right, ref useSiteInfo);
1113
if (better ==
BetterResult
.Left)
1117
else if (better ==
BetterResult
.Right)
1146
var
better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, left, right, ref useSiteInfo);
1147
if (better ==
BetterResult
.Right)
1152
else if (better !=
BetterResult
.Left)
1168
var
better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, left, right, ref useSiteInfo);
1169
if (better !=
BetterResult
.Left)
1179
private
BetterResult
BetterOperator(BinaryOperatorSignature op1, BinaryOperatorSignature op2, BoundExpression left, BoundExpression right, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1185
return (op1.Priority.GetValueOrDefault() < op2.Priority.GetValueOrDefault()) ?
BetterResult
.Left :
BetterResult
.Right;
1188
BetterResult
leftBetter = BetterConversionFromExpression(left, op1.LeftType, op2.LeftType, ref useSiteInfo);
1189
BetterResult
rightBetter = BetterConversionFromExpression(right, op1.RightType, op2.RightType, ref useSiteInfo);
1210
if (leftBetter ==
BetterResult
.Left && rightBetter !=
BetterResult
.Right ||
1211
leftBetter !=
BetterResult
.Right && rightBetter ==
BetterResult
.Left)
1213
return
BetterResult
.Left;
1216
if (leftBetter ==
BetterResult
.Right && rightBetter !=
BetterResult
.Left ||
1217
leftBetter !=
BetterResult
.Left && rightBetter ==
BetterResult
.Right)
1219
return
BetterResult
.Right;
1251
BetterResult
result = MoreSpecificOperator(op1, op2, ref useSiteInfo);
1252
if (result ==
BetterResult
.Left || result ==
BetterResult
.Right)
1265
return
BetterResult
.Right;
1269
return
BetterResult
.Left;
1274
BetterResult
valOverInPreference;
1278
valOverInPreference =
BetterResult
.Left;
1282
valOverInPreference =
BetterResult
.Right;
1286
valOverInPreference =
BetterResult
.Neither;
1291
if (valOverInPreference ==
BetterResult
.Right)
1293
return
BetterResult
.Neither;
1297
valOverInPreference =
BetterResult
.Left;
1302
if (valOverInPreference ==
BetterResult
.Left)
1304
return
BetterResult
.Neither;
1308
valOverInPreference =
BetterResult
.Right;
1315
private
BetterResult
MoreSpecificOperator(BinaryOperatorSignature op1, BinaryOperatorSignature op2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1361
BetterResult
result = MoreSpecificType(ref uninst1.AsRef(), ref uninst2.AsRef(), ref useSiteInfo);
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (17)
117
var
better = BetterOperator(candidates[i].Signature, candidates[j].Signature, operand, ref useSiteInfo);
118
if (better ==
BetterResult
.Left)
122
else if (better ==
BetterResult
.Right)
150
var
better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, operand, ref useSiteInfo);
151
if (better ==
BetterResult
.Right)
156
else if (better !=
BetterResult
.Left)
172
var
better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, operand, ref useSiteInfo);
173
if (better !=
BetterResult
.Left)
183
private
BetterResult
BetterOperator(UnaryOperatorSignature op1, UnaryOperatorSignature op2, BoundExpression operand, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
188
BetterResult
better = BetterConversionFromExpression(operand, op1.OperandType, op2.OperandType, ref useSiteInfo);
190
if (better ==
BetterResult
.Left || better ==
BetterResult
.Right)
220
return
BetterResult
.Right;
224
return
BetterResult
.Left;
231
return
BetterResult
.Left;
235
return
BetterResult
.Right;
238
return
BetterResult
.Neither;
Binder\Semantics\OverloadResolution\OverloadResolution.cs (138)
1796
var
better = BetterFunctionMember(results[currentBestIndex], results[index], arguments.Arguments, ref useSiteInfo);
1797
if (better ==
BetterResult
.Right)
1802
else if (better !=
BetterResult
.Left)
1823
var
better = BetterFunctionMember(results[currentBestIndex], results[index], arguments.Arguments, ref useSiteInfo);
1824
if (better !=
BetterResult
.Left)
1986
var
better = BetterFunctionMember(c1Result, c2Result, arguments.Arguments, ref useSiteInfo);
1987
if (better ==
BetterResult
.Left)
1991
else if (better ==
BetterResult
.Right)
2026
results[i] =
BetterResult
.Left == BetterFunctionMember(results[notBestIdx], results[i], arguments.Arguments, ref useSiteInfo)
2070
private
BetterResult
BetterFunctionMember<TMember>(
2086
return
BetterResult
.Left;
2088
return
BetterResult
.Right;
2101
return hasAnyRefOmittedArgument1 ?
BetterResult
.Right :
BetterResult
.Left;
2109
private
BetterResult
BetterFunctionMember<TMember>(
2129
BetterResult
result =
BetterResult
.Neither;
2164
BetterResult
r;
2189
if (r ==
BetterResult
.Neither)
2206
if (result ==
BetterResult
.Neither)
2229
result =
BetterResult
.Neither;
2250
result =
BetterResult
.Neither;
2256
Debug.Assert(result ==
BetterResult
.Left || result ==
BetterResult
.Right);
2263
if (result !=
BetterResult
.Neither)
2344
return
BetterResult
.Right;
2350
return
BetterResult
.Left;
2359
return
BetterResult
.Left;
2363
return
BetterResult
.Right;
2375
return
BetterResult
.Left;
2380
return
BetterResult
.Right;
2388
return
BetterResult
.Left;
2393
return
BetterResult
.Right;
2411
return
BetterResult
.Left;
2416
return
BetterResult
.Right;
2428
return
BetterResult
.Left;
2433
return
BetterResult
.Right;
2468
if (result !=
BetterResult
.Neither)
2488
return
BetterResult
.Left;
2493
return
BetterResult
.Right;
2502
return (m1ModifierCount < m2ModifierCount) ?
BetterResult
.Left :
BetterResult
.Right;
2508
if (result !=
BetterResult
.Neither)
2538
var
betterResult = BetterParamsCollectionType(t1, t2, ref useSiteInfo);
2539
if (betterResult !=
BetterResult
.Neither)
2547
return
BetterResult
.Neither;
2593
private static
BetterResult
PreferValOverInOrRefInterpolatedHandlerParameters<TMember>(
2601
BetterResult
valOverInOrRefInterpolatedHandlerPreference =
BetterResult
.Neither;
2623
if (valOverInOrRefInterpolatedHandlerPreference ==
BetterResult
.Right)
2625
return
BetterResult
.Neither;
2629
valOverInOrRefInterpolatedHandlerPreference =
BetterResult
.Left;
2634
if (valOverInOrRefInterpolatedHandlerPreference ==
BetterResult
.Left)
2636
return
BetterResult
.Neither;
2640
valOverInOrRefInterpolatedHandlerPreference =
BetterResult
.Right;
2690
private static
BetterResult
MoreSpecificType(ref TemporaryArray<TypeSymbol> t1, ref TemporaryArray<TypeSymbol> t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2697
var
result =
BetterResult
.Neither;
2700
var
r = MoreSpecificType(t1[i], t2[i], ref useSiteInfo);
2701
if (r ==
BetterResult
.Neither)
2705
else if (result ==
BetterResult
.Neither)
2715
return
BetterResult
.Neither;
2722
private static
BetterResult
MoreSpecificType(TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2732
return
BetterResult
.Right;
2737
return
BetterResult
.Left;
2742
return
BetterResult
.Neither;
2776
return
BetterResult
.Neither;
2791
return
BetterResult
.Neither;
2804
var
result = MoreSpecificType(ref allTypeArgs1.AsRef(), ref allTypeArgs2.AsRef(), ref useSiteInfo);
2810
private
BetterResult
BetterConversionFromExpression(BoundExpression node, TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2824
private
BetterResult
BetterConversionFromExpression(
2863
return conv1.Kind == ConversionKind.Identity ?
BetterResult
.Left :
BetterResult
.Neither;
2867
return conv2.Kind == ConversionKind.Identity ?
BetterResult
.Right :
BetterResult
.Neither;
2872
return
BetterResult
.Neither;
2880
private
BetterResult
BetterConversionFromExpression(BoundExpression node, TypeSymbol t1, Conversion conv1, TypeSymbol t2, Conversion conv2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out bool okToDowngradeToNeither)
2887
return
BetterResult
.Neither;
2899
return
BetterResult
.Neither;
2920
return
BetterResult
.Neither;
2922
return
BetterResult
.Left;
2924
return
BetterResult
.Right;
2933
return
BetterResult
.Left;
2935
return
BetterResult
.Right;
2949
okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(
BetterResult
.Left, lambdaOpt, t1, t2, ref useSiteInfo, false);
2950
return
BetterResult
.Left;
2955
okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(
BetterResult
.Right, lambdaOpt, t1, t2, ref useSiteInfo, false);
2956
return
BetterResult
.Right;
2961
return
BetterResult
.Left;
2963
return
BetterResult
.Right;
2977
return
BetterResult
.Right;
2979
return
BetterResult
.Left;
2987
private
BetterResult
BetterCollectionExpressionConversion(
3000
return
BetterResult
.Left;
3004
return
BetterResult
.Right;
3007
return
BetterResult
.Neither;
3021
private
BetterResult
BetterCollectionExpressionConversion(
3048
return
BetterResult
.Left;
3050
return
BetterResult
.Right;
3067
var
betterResult =
BetterResult
.Neither;
3078
BetterResult
elementBetterResult;
3088
if (elementBetterResult ==
BetterResult
.Neither)
3093
if (betterResult !=
BetterResult
.Neither)
3097
return
BetterResult
.Neither;
3118
return
BetterResult
.Left;
3122
return
BetterResult
.Right;
3126
return
BetterResult
.Neither;
3165
private
BetterResult
BetterParamsCollectionType(TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3391
private
BetterResult
BetterConversionTargetCore(
3399
return
BetterResult
.Neither;
3406
private
BetterResult
BetterConversionTarget(
3418
private
BetterResult
BetterConversionTargetCore(
3433
return
BetterResult
.Neither;
3447
return
BetterResult
.Neither;
3451
okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(
BetterResult
.Left, lambdaOpt, type1, type2, ref useSiteInfo, true);
3452
return
BetterResult
.Left;
3457
okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(
BetterResult
.Right, lambdaOpt, type1, type2, ref useSiteInfo, true);
3458
return
BetterResult
.Right;
3475
return
BetterResult
.Neither;
3480
return
BetterResult
.Neither;
3501
BetterResult
delegateResult =
BetterResult
.Neither;
3508
delegateResult =
BetterResult
.Left;
3514
delegateResult =
BetterResult
.Right;
3517
if (delegateResult ==
BetterResult
.Neither)
3530
if (delegateResult ==
BetterResult
.Left)
3534
return
BetterResult
.Neither;
3537
else if (delegateResult ==
BetterResult
.Right && IsMethodGroupConversionIncompatibleWithDelegate(group, d2, conv2))
3539
return
BetterResult
.Neither;
3548
return
BetterResult
.Neither;
3553
return
BetterResult
.Neither;
3565
return
BetterResult
.Left;
3570
return
BetterResult
.Right;
3573
return
BetterResult
.Neither;
3587
private bool CanDowngradeConversionFromLambdaToNeither(
BetterResult
currentResult, UnboundLambda lambda, TypeSymbol type1, TypeSymbol type2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool fromTypeAnalysis)
3639
Debug.Assert(currentResult ==
BetterResult
.Right);
3644
Debug.Assert(currentResult ==
BetterResult
.Left);