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
public void Run(ITreeNode element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) | |
{ | |
var ifStatement = element as IIfStatement; | |
if (ifStatement != null) | |
{ | |
CheckCondition(ifStatement.Condition, consumer); | |
return; | |
} | |
var whileStatement = element as IWhileStatement; |
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 (from.PrevSibling != null && from.PrevSibling.GetTokenType() == CSharpTokenType.WHITE_SPACE) | |
from = from.PrevSibling; |
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
public delegate ref int RefIntFunc(); | |
public delegate ref T RefFunc<T>(); | |
public delegate ref TReturn RefFunc<T, TReturn>(T arg); | |
public delegate ref TReturn RefFunc<T1, T2, TReturn>(T1 arg1, T2 arg2); | |
public interface IWithRefReturns { | |
ref int RefIntMethod(); | |
ref string RefStringMethod(); | |
ref int RefIntProperty { get; } |
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] | |
private static bool HasContainingUnclosedBlocks([NotNull] ILocalFunctionDeclaration localFunctionDeclaration) | |
{ | |
foreach (var containingNode in localFunctionDeclaration.ContainingNodes()) | |
{ | |
var containingBlock = containingNode as IBlock; | |
if (containingBlock != null && containingBlock.RBrace == null) return true; | |
var switchBlock = containingNode as ISwitchBlock; | |
if (switchBlock != null && switchBlock.RBrace == null) return true; |
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
public void Run(ITreeNode element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) | |
{ | |
var prefixOperatorExpression = element as IPrefixOperatorExpression; | |
if (prefixOperatorExpression != null) | |
{ | |
switch (prefixOperatorExpression.PrefixOperatorType) | |
{ | |
case PrefixOperatorType.PLUSPLUS: | |
case PrefixOperatorType.MINUSMINUS: | |
{ |
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
using System; | |
// ReSharper disable UnusedParameter.Local | |
// ReSharper disable UnusedVariable | |
// ReSharper disable FunctionRecursiveOnAllPaths | |
public class WriteTest | |
{ | |
public void RefArgument<T>(ref T t) { } | |
public void LocalVariable() |
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
public IType GetEqualityParameterType(int parameterIndex) | |
{ | |
if (myCachedEqualityParameterTypes[parameterIndex] == null) | |
myCachedEqualityParameterTypes[parameterIndex] = myEqualitySubstitution.Apply(myParameters[parameterIndex].Type); | |
return myCachedEqualityParameterTypes[parameterIndex]; | |
} |
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 pattern = Pattern; | |
var constantPattern = pattern as IConstantPattern; | |
if (constantPattern != null) | |
{ | |
return IsTypeFromConstantPattern(constantPattern); | |
} | |
var declarationPattern = pattern as IDeclarationPattern; | |
if (declarationPattern != null) |
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] | |
private static bool IsFullyDiscardedDeconstructionExpression([NotNull] ITupleCreationExpression tupleCreationExpression) | |
{ | |
foreach (var tupleArgument in tupleCreationExpression.ArgumentsEnumerable) | |
{ | |
if (tupleArgument.NameIdentifier != null) return false; | |
if (tupleArgument.Colon != null) return false; | |
var tupleArgumentValue = tupleArgument.Value; |
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 typeCheckClassification = typeCheckType.ClassifyTypeAdvanced(); | |
if (typeCheckClassification == TypeParameterOracle.Classification.REFERENCE_TYPE && sourceType.IsValueType()) | |
return TypeCheckStaticAnalysisResult.AlwaysFalse; | |
if (typeCheckClassification == TypeParameterOracle.Classification.NON_NULLABLE_VALUE_TYPE && sourceType.IsReferenceType()) | |
return TypeCheckStaticAnalysisResult.AlwaysFalse; |