View foo1.cs
This file contains 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 IPredefinedTypeUsage predefinedTypeUsage: | |
return predefinedTypeUsage.Parent is IEnumBase | |
? null | |
: InspectPredefinedTypeUsage(predefinedTypeUsage, predefinedTypeUsage.ScalarPredefinedTypeName, boundSettingsStore); |
View foo1.cs
This file contains 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
public override AbstractValueWithInfo Divide(AbstractValue divisor) | |
{ | |
switch (divisor) | |
{ | |
case Scalar otherScalar when (otherScalar.Value == 0): | |
return AbstractValueWithInfo.DivisionByZero; | |
case Scalar otherScalar when (otherScalar.Value == 1): | |
return new AbstractValueWithInfo(this, ErrorType.DivisionByOne); | |
case Scalar otherScalar: | |
var result = Divide(myInterval, otherScalar.Value); |
View foo1.cs
This file contains 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 argumentType = typeofExpression.ArgumentType; | |
if (!(argumentType is IDeclaredType declaredType) | |
|| declaredType.IsVoid() | |
|| declaredType is IDynamicType) return null; | |
var typeElement = declaredType.GetTypeElement(); | |
if (typeElement is ITypeParameter) return null; | |
return typeElement?.TypeParameters.Count == 0 ? typeElement : null; |
View foo1.cs
This file contains 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 operand = dagOwnerElement.SourceElement is IIsExpression sourceIsExpression ? sourceIsExpression.Operand | |
: dagOwnerElement.SourceElement is ISwitchStatement sourceSwitchStatement ? sourceSwitchStatement.GoverningExpression | |
: dagOwnerElement.SourceElement is ISwitchExpression sourceSwitchExpression ? sourceSwitchExpression.GoverningExpression | |
: null; |
View foo1.cs
This file contains 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 str = obj as string; | |
if (str != null) { | |
WriteLine(str.Length); | |
} |
View foo1.cs
This file contains 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 localFunctionDeclaration = declarationStatement.LocalFunctionDeclaration; | |
if (localFunctionDeclaration != null) | |
consumer.Add(localFunctionDeclaration.DeclaredElement); |
View foo1.cs
This file contains 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 indexerDeclaration = declaration as IIndexerDeclaration; | |
if (indexerDeclaration != null) | |
{ | |
var arrowClause = indexerDeclaration.ArrowClause; | |
if (arrowClause != null) | |
{ | |
var property = indexerDeclaration.DeclaredElement; | |
if (property != null) | |
{ | |
... |
View foo1.cs
This file contains 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 (referenceExpression.QualifierType() is IDeclaredType declaredType) | |
{ | |
if (declaredType.GetTypeElement() is IStruct @struct && @struct.IsByRefLike) | |
{ | |
consumer.AddHighlighting(new RefStructMethodGroupsError(referenceExpression)); | |
} | |
} |
View foo1.cs
This file contains 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
public override bool Accepts(IDeclaredElement declaredElement, ISubstitution substitution) | |
{ | |
switch (declaredElement) | |
{ | |
case ISymbolAlias symbolAlias: | |
{ | |
var aliasedSymbol = symbolAlias.GetAliasedSymbol(); | |
if (aliasedSymbol == null) return true; | |
return Accepts(aliasedSymbol.Element, aliasedSymbol.Substitution); |
View foo1.cs
This file contains 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
[NotNull, Pure] | |
public static IPattern UnwrapFromSandbox([NotNull] this IPattern pattern) | |
{ | |
if (pattern.Parent is ISandBox sandBox | |
&& sandBox.ContextType == SandBoxContextType.Replace | |
&& sandBox.ContextNode is IPattern replacedPattern) | |
{ | |
return replacedPattern; | |
} |