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 (invocationExpression.InvokedExpression is IReferenceExpression invokedReferenceExpression | |
&& invokedReferenceExpression.TypeArgumentList != null | |
&& invokedReferenceExpression.TypeArgumentList.TypeArgumentNodes.Count == 0 | |
&& invokedReferenceExpression.TypeArgumentList.LAngle != null | |
&& invokedReferenceExpression.TypeArgumentList.RAngle != null) | |
{ | |
textControl.Caret.MoveTo(invokedReferenceExpression.TypeArgumentList.RAngle.GetDocumentStartOffset(), CaretVisualPlacement.DontScrollIfVisible); | |
return; | |
} |
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 (myConditionalExpression.ThenResult is IRefExpression thenRefExpression && thenRefExpression.Expression != null) | |
{ | |
thenRefExpression.ReplaceBy(thenRefExpression.Expression); | |
} | |
else if (myConditionalExpression.ElseResult is IRefExpression elseRefExpression && elseRefExpression.Expression != null) | |
{ | |
elseRefExpression.ReplaceBy(elseRefExpression.Expression); | |
} |
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
private static bool CheckHasValidRefOperands( | |
[NotNull] IConditionalTernaryExpression expression, | |
[NotNull] ICSharpExpression thenResult, | |
[NotNull] ICSharpExpression elseResult, | |
[NotNull] IHighlightingConsumer consumer) | |
{ | |
var thenRefExpression = thenResult as IRefExpression; | |
var elseRefExpression = elseResult as IRefExpression; | |
if (elseRefExpression != null && thenRefExpression == 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
[CanBeNull] | |
private static ITreeNode GetHighlightingNodeFromExpressionStatement([NotNull] IExpressionStatement statement) | |
{ | |
var expression = statement.Expression; | |
while (expression != null) | |
{ | |
var reference = expression as IReferenceExpression; | |
if (reference != 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
private void CheckRefConditionalIssues( | |
[NotNull] IConditionalTernaryExpression expression, | |
[NotNull] ICSharpExpression thenResult, | |
[NotNull] ICSharpExpression elseResult, | |
[NotNull] IHighlightingConsumer consumer) | |
{ | |
var thenRefExpression = thenResult as IRefExpression; | |
var elseRefExpression = elseResult as IRefExpression; | |
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 condition = expression.ConditionOperand; | |
if (condition == null) return; | |
var thenResult = expression.ThenResult; | |
if (thenResult == null) return; | |
var elseResult = expression.ElseResult; | |
if (elseResult == null) return; | |
// ... |
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
[NotNull, Pure] | |
public static string Present(this TypeKind kind) { | |
switch (kind) { | |
case TypeKind.StaticClass: return "S"; | |
case TypeKind.AbstractClass: return "A"; | |
case TypeKind.Interface: return "I"; | |
case TypeKind.Enumeration: return "E"; | |
case TypeKind.ValueType: return "V"; | |
default: return "C"; | |
} |
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 RangeKind RangeKind | |
{ | |
get | |
{ | |
var hasStartIndex = LeftOperand != null; | |
var hasEndIndex = RightOperand != null; | |
if (hasStartIndex) | |
{ | |
return hasEndIndex ? RangeKind.FromStartToEnd : RangeKind.FromStart; |
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 bool HasReference(ITreeNode element, IReferenceNameContainer names) | |
{ | |
var argument = element as ICSharpArgument; | |
if (argument != null) | |
{ | |
var literal = argument.Value.GetOperandThroughParenthesis() as ICSharpLiteralExpression; | |
if (literal == null) return false; | |
if (!IsStringLiteralExpression(literal)) 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
switch (presentation[index]) | |
{ | |
case '\\': | |
case '\n': | |
return false; | |
case '\"': | |
if (inCharacterLiteral) | |
{ | |
valueBuilder.Append(presentation[index]); |