This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var genericType = myIsAsync | |
? useEnumeratorType | |
? predefinedType.IAsyncEnumerator | |
: predefinedType.IAsyncEnumerable | |
: useEnumeratorType | |
? predefinedType.GenericIEnumerator | |
: predefinedType.GenericIEnumerable; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case IRecursivePattern recursivePattern | |
when recursivePattern.TypeUsage == null | |
&& recursivePattern.DeconstructionPatternClause == null | |
&& recursivePattern.PropertyPatternClause is IPropertyPatternClause patternPropertyPatternClause | |
&& patternPropertyPatternClause.PatternsEnumerable.IsEmpty() | |
&& recursivePattern.Designation == null | |
&& !recursivePattern.ContainsPreprocessorDirectives(): | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Pure] | |
public static bool CanRemoveDesignation([NotNull] this IRecursivePattern recursivePattern) | |
{ | |
if (recursivePattern.TypeUsage == null && recursivePattern.PropertyPatternClause == null) | |
{ | |
var deconstructionPatternClause = recursivePattern.DeconstructionPatternClause; | |
if (deconstructionPatternClause != null) | |
{ | |
if (deconstructionPatternClause.Patterns.Count == 1) return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tupleTypeComponent = tupleType.ComponentOrNull(componentIndex); | |
if (tupleTypeComponent != null) | |
{ | |
var actualTypeName = tupleTypeComponent.Value.ExplicitName ?? TupleTypeComponent.GetDefaultComponentName(componentIndex); | |
consumer.AddHighlighting(new DeconstructionSubpatternWrongTupleComponentNameError(subpattern, actualTypeName)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch (expression.GetOperandThroughParenthesisStrict()) | |
{ | |
case INullCoalescingExpression nullCoalescingExpression when nullCoalescingExpression.RightOperand is IThrowExpression: | |
expression = nullCoalescingExpression.LeftOperand.GetOperandThroughParenthesisStrict(); | |
break; | |
case IInvocationExpression invocationExpression: | |
break; | |
default: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sourceExpression = DeconstructionUtil.FindExpressionInTuple(infoInExpression); | |
if (sourceExpression != null && sourceExpression.Value.Indices.Count == 0) | |
{ | |
namesCollection.Add(sourceExpression.Value.TopmostExpression, new EntryOptions(subrootPolicy: SubrootPolicy.Decompose)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (previousMember is IExpressionBodyOwnerDeclaration expressionBodyOwnerDeclaration) | |
{ | |
return expressionBodyOwnerDeclaration.ArrowClause?.Expression != null | |
&& expressionBodyOwnerDeclaration.Semicolon == null; | |
} | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Pure, ContractAnnotation("null => false")] | |
public static bool IsValueTuple([CanBeNull] this ITypeElement typeElement) | |
{ | |
var structType = typeElement as IStruct; | |
if (structType == null) return false; | |
return typeElement.ShortName == "ValueTuple" | |
&& typeElement.GetContainingNamespace() is INamespace ns | |
&& ns.ShortName == "System" | |
&& ns.GetContainingNamespace() is INamespace root |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var inferredType = currentStyle == VariableStyle.UseVar | |
? variableType | |
: deconstructionInfo.Indices.IsEmpty() | |
? deconstructionInfo.TopmostExpression.Type() | |
: FindInferredTypeForDeconstructionVariable(deconstructionInfo.TopmostExpression.GetExpressionType(),deconstructionInfo.Indices); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isInGeneratedCode = IsInGeneratedCode(node, parameters.RegionsInfo); | |
UsageState state; | |
if (isInGeneratedCode != null) | |
{ | |
state = (bool) isInGeneratedCode | |
? UsageState.METHOD_ASSIGNED_TO_DELEGATE_IN_GENERATED_CODE | |
: UsageState.METHOD_ASSIGNED_TO_DELEGATE_IN_USER_CODE; | |
} | |
else |