213 references to BetterResult
Microsoft.CodeAnalysis.CSharp (213)
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (16)
735
return
BetterResult
.Equal;
742
return
BetterResult
.Neither;
744
return leftWins ?
BetterResult
.Left :
BetterResult
.Right;
774
return
BetterResult
.Equal;
781
return
BetterResult
.Neither;
783
return leftWins ?
BetterResult
.Left :
BetterResult
.Right;
804
private static int? UniqueBestValidIndex<T>(ImmutableArray<T> items, Func<T, bool> valid, Func<T, T,
BetterResult
> better)
829
BetterResult
result = better(candidateItem, currentItem);
831
if (result ==
BetterResult
.Equal)
836
else if (result ==
BetterResult
.Neither)
844
else if (result ==
BetterResult
.Right)
871
BetterResult
result = better(candidateItem, currentItem);
872
if (result !=
BetterResult
.Left && result !=
BetterResult
.Equal)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (40)
1117
var
better = BetterOperator(candidates[i].Signature, candidates[j].Signature, left, right, ref useSiteInfo);
1118
if (better ==
BetterResult
.Left)
1122
else if (better ==
BetterResult
.Right)
1151
var
better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, left, right, ref useSiteInfo);
1152
if (better ==
BetterResult
.Right)
1157
else if (better !=
BetterResult
.Left)
1173
var
better = BetterOperator(candidates[currentBestIndex].Signature, candidates[index].Signature, left, right, ref useSiteInfo);
1174
if (better !=
BetterResult
.Left)
1184
private
BetterResult
BetterOperator(BinaryOperatorSignature op1, BinaryOperatorSignature op2, BoundExpression left, BoundExpression right, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1190
return (op1.Priority.GetValueOrDefault() < op2.Priority.GetValueOrDefault()) ?
BetterResult
.Left :
BetterResult
.Right;
1193
BetterResult
leftBetter = BetterConversionFromExpression(left, op1.LeftType, op2.LeftType, ref useSiteInfo);
1194
BetterResult
rightBetter = BetterConversionFromExpression(right, op1.RightType, op2.RightType, ref useSiteInfo);
1215
if (leftBetter ==
BetterResult
.Left && rightBetter !=
BetterResult
.Right ||
1216
leftBetter !=
BetterResult
.Right && rightBetter ==
BetterResult
.Left)
1218
return
BetterResult
.Left;
1221
if (leftBetter ==
BetterResult
.Right && rightBetter !=
BetterResult
.Left ||
1222
leftBetter !=
BetterResult
.Left && rightBetter ==
BetterResult
.Right)
1224
return
BetterResult
.Right;
1256
BetterResult
result = MoreSpecificOperator(op1, op2, ref useSiteInfo);
1257
if (result ==
BetterResult
.Left || result ==
BetterResult
.Right)
1270
return
BetterResult
.Right;
1274
return
BetterResult
.Left;
1279
BetterResult
valOverInPreference;
1283
valOverInPreference =
BetterResult
.Left;
1287
valOverInPreference =
BetterResult
.Right;
1291
valOverInPreference =
BetterResult
.Neither;
1296
if (valOverInPreference ==
BetterResult
.Right)
1298
return
BetterResult
.Neither;
1302
valOverInPreference =
BetterResult
.Left;
1307
if (valOverInPreference ==
BetterResult
.Left)
1309
return
BetterResult
.Neither;
1313
valOverInPreference =
BetterResult
.Right;
1320
private
BetterResult
MoreSpecificOperator(BinaryOperatorSignature op1, BinaryOperatorSignature op2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1366
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 (140)
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)
1994
var
better = BetterFunctionMember(c1Result, c2Result, arguments.Arguments, ref useSiteInfo);
1995
if (better ==
BetterResult
.Left)
1999
else if (better ==
BetterResult
.Right)
2034
results[i] =
BetterResult
.Left == BetterFunctionMember(results[notBestIdx], results[i], arguments.Arguments, ref useSiteInfo)
2078
private
BetterResult
BetterFunctionMember<TMember>(
2094
return
BetterResult
.Left;
2096
return
BetterResult
.Right;
2109
return hasAnyRefOmittedArgument1 ?
BetterResult
.Right :
BetterResult
.Left;
2117
private
BetterResult
BetterFunctionMember<TMember>(
2137
BetterResult
result =
BetterResult
.Neither;
2172
BetterResult
r;
2197
if (r ==
BetterResult
.Neither)
2214
if (result ==
BetterResult
.Neither)
2237
result =
BetterResult
.Neither;
2258
result =
BetterResult
.Neither;
2264
Debug.Assert(result ==
BetterResult
.Left || result ==
BetterResult
.Right);
2271
if (result !=
BetterResult
.Neither)
2352
return
BetterResult
.Right;
2358
return
BetterResult
.Left;
2367
return
BetterResult
.Left;
2371
return
BetterResult
.Right;
2383
return
BetterResult
.Left;
2388
return
BetterResult
.Right;
2396
return
BetterResult
.Left;
2401
return
BetterResult
.Right;
2419
return
BetterResult
.Left;
2424
return
BetterResult
.Right;
2436
return
BetterResult
.Left;
2441
return
BetterResult
.Right;
2476
if (result !=
BetterResult
.Neither)
2496
return
BetterResult
.Left;
2501
return
BetterResult
.Right;
2510
return (m1ModifierCount < m2ModifierCount) ?
BetterResult
.Left :
BetterResult
.Right;
2516
if (result !=
BetterResult
.Neither)
2546
var
betterResult = BetterParamsCollectionType(t1, t2, ref useSiteInfo);
2547
if (betterResult !=
BetterResult
.Neither)
2555
return
BetterResult
.Neither;
2601
private static
BetterResult
PreferValOverInOrRefInterpolatedHandlerParameters<TMember>(
2609
BetterResult
valOverInOrRefInterpolatedHandlerPreference =
BetterResult
.Neither;
2631
if (valOverInOrRefInterpolatedHandlerPreference ==
BetterResult
.Right)
2633
return
BetterResult
.Neither;
2637
valOverInOrRefInterpolatedHandlerPreference =
BetterResult
.Left;
2642
if (valOverInOrRefInterpolatedHandlerPreference ==
BetterResult
.Left)
2644
return
BetterResult
.Neither;
2648
valOverInOrRefInterpolatedHandlerPreference =
BetterResult
.Right;
2698
private static
BetterResult
MoreSpecificType(ref TemporaryArray<TypeSymbol> t1, ref TemporaryArray<TypeSymbol> t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2705
var
result =
BetterResult
.Neither;
2708
var
r = MoreSpecificType(t1[i], t2[i], ref useSiteInfo);
2709
if (r ==
BetterResult
.Neither)
2713
else if (result ==
BetterResult
.Neither)
2723
return
BetterResult
.Neither;
2730
private static
BetterResult
MoreSpecificType(TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2740
return
BetterResult
.Right;
2745
return
BetterResult
.Left;
2750
return
BetterResult
.Neither;
2784
return
BetterResult
.Neither;
2799
return
BetterResult
.Neither;
2812
var
result = MoreSpecificType(ref allTypeArgs1.AsRef(), ref allTypeArgs2.AsRef(), ref useSiteInfo);
2818
private
BetterResult
BetterConversionFromExpression(BoundExpression node, TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2832
private
BetterResult
BetterConversionFromExpression(
2871
return conv1.Kind == ConversionKind.Identity ?
BetterResult
.Left :
BetterResult
.Neither;
2875
return conv2.Kind == ConversionKind.Identity ?
BetterResult
.Right :
BetterResult
.Neither;
2880
return
BetterResult
.Neither;
2888
private
BetterResult
BetterConversionFromExpression(BoundExpression node, TypeSymbol t1, Conversion conv1, TypeSymbol t2, Conversion conv2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out bool okToDowngradeToNeither)
2895
return
BetterResult
.Neither;
2907
return
BetterResult
.Neither;
2928
return
BetterResult
.Neither;
2930
return
BetterResult
.Left;
2932
return
BetterResult
.Right;
2941
return
BetterResult
.Left;
2943
return
BetterResult
.Right;
2957
okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(
BetterResult
.Left, lambdaOpt, t1, t2, ref useSiteInfo, false);
2958
return
BetterResult
.Left;
2963
okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(
BetterResult
.Right, lambdaOpt, t1, t2, ref useSiteInfo, false);
2964
return
BetterResult
.Right;
2969
return
BetterResult
.Left;
2971
return
BetterResult
.Right;
2988
return
BetterResult
.Left;
2993
return
BetterResult
.Right;
2998
return
BetterResult
.Right;
3000
return
BetterResult
.Left;
3008
private
BetterResult
BetterCollectionExpressionConversion(
3021
return
BetterResult
.Left;
3025
return
BetterResult
.Right;
3028
return
BetterResult
.Neither;
3042
private
BetterResult
BetterCollectionExpressionConversion(
3069
return
BetterResult
.Left;
3071
return
BetterResult
.Right;
3088
var
betterResult =
BetterResult
.Neither;
3099
BetterResult
elementBetterResult;
3109
if (elementBetterResult ==
BetterResult
.Neither)
3114
if (betterResult !=
BetterResult
.Neither)
3118
return
BetterResult
.Neither;
3139
return
BetterResult
.Left;
3143
return
BetterResult
.Right;
3147
return
BetterResult
.Neither;
3186
private
BetterResult
BetterParamsCollectionType(TypeSymbol t1, TypeSymbol t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3412
private
BetterResult
BetterConversionTargetCore(
3420
return
BetterResult
.Neither;
3427
private
BetterResult
BetterConversionTarget(
3439
private
BetterResult
BetterConversionTargetCore(
3454
return
BetterResult
.Neither;
3468
return
BetterResult
.Neither;
3472
okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(
BetterResult
.Left, lambdaOpt, type1, type2, ref useSiteInfo, true);
3473
return
BetterResult
.Left;
3478
okToDowngradeToNeither = lambdaOpt != null && CanDowngradeConversionFromLambdaToNeither(
BetterResult
.Right, lambdaOpt, type1, type2, ref useSiteInfo, true);
3479
return
BetterResult
.Right;
3496
return
BetterResult
.Neither;
3501
return
BetterResult
.Neither;
3522
BetterResult
delegateResult =
BetterResult
.Neither;
3529
delegateResult =
BetterResult
.Left;
3535
delegateResult =
BetterResult
.Right;
3538
if (delegateResult ==
BetterResult
.Neither)
3551
if (delegateResult ==
BetterResult
.Left)
3555
return
BetterResult
.Neither;
3558
else if (delegateResult ==
BetterResult
.Right && IsMethodGroupConversionIncompatibleWithDelegate(group, d2, conv2))
3560
return
BetterResult
.Neither;
3569
return
BetterResult
.Neither;
3574
return
BetterResult
.Neither;
3586
return
BetterResult
.Left;
3591
return
BetterResult
.Right;
3594
return
BetterResult
.Neither;
3608
private bool CanDowngradeConversionFromLambdaToNeither(
BetterResult
currentResult, UnboundLambda lambda, TypeSymbol type1, TypeSymbol type2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool fromTypeAnalysis)
3660
Debug.Assert(currentResult ==
BetterResult
.Right);
3665
Debug.Assert(currentResult ==
BetterResult
.Left);