213 references to BetterResult
Microsoft.CodeAnalysis.CSharp (213)
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 (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);