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
foreach (var pair in myNotClosedTags) | |
{ | |
consumer.AddHighlighting(new XmlTagIsNotClosedHighlighting2(pair.Value, pair.Key), pair.Key); | |
} |
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
/* | |
What is this? (int x, int y) | |
*/ | |
(int x, int y) => x + y; | |
int M(int x, int y) => x + y; | |
(int x, int y) = (1, 2); | |
foreach ((int x, int y) in xs) { } | |
int M((int x, int y) t) => t.x + t.y; |
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
while (ReferenceNameNavigator.GetByQualifier(referenceName) != null) | |
referenceName = ReferenceNameNavigator.GetByQualifier(referenceName); |
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
while (GetSomethingToUseTwice() is var x | |
&& x != null | |
&& UseOnceMore(x) | |
&& AndMore(x)) | |
{ | |
// ... | |
} | |
// C#'s 'is var t' var pattern to introduce a name for expression where statements are not allowed | |
// is somewhat similar to 'let-in' from functional languages: |
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 warningDirective = element as IWarningDirective; | |
if (warningDirective != null) | |
{ | |
var messageToken = "#warning directive"; | |
var tokenNode = warningDirective.Message; | |
if (tokenNode != null) messageToken = tokenNode.GetText(); |
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 orExpression = condition as IConditionalOrExpression; | |
if (orExpression != null) | |
{ | |
return ToSimpleConditions(leftOperand) && ToSimpleConditions(rightOperand); | |
} | |
var andExpression = condition as IConditionalAndExpression; | |
if (andExpression == null || myCSharpLanguageLevel < CSharpLanguageLevel.CSharp60) | |
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
private static BodyKind InspectStatement([CanBeNull] ICSharpStatement statement) { | |
var ifStatement = statement as IIfStatement; | |
if (ifStatement != null) { | |
var thenResult = InspectStatement(ifStatement.Then); | |
if (thenResult == BodyKind.HasBreakOrGotoCase) return thenResult; | |
var elseResult = InspectStatement(ifStatement.Else); | |
if (elseResult == BodyKind.HasBreakOrGotoCase) return elseResult; | |
if (thenResult == BodyKind.ReturnAtEnd && elseResult == BodyKind.ReturnAtEnd) |
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 unaryExpression = selector.Body as UnaryExpression; | |
var binaryExpression = unaryExpression == null ? null : unaryExpression.Operand as BinaryExpression; | |
// vs. | |
var unaryExpression = selector.Body as UnaryExpression; | |
var binaryExpression = unaryExpression?.Operand as BinaryExpression; | |
// vs. |
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]); |
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; |