Created
January 11, 2017 18:24
-
-
Save controlflow/c417504e045990a90665b7182f027be1 to your computer and use it in GitHub Desktop.
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; | |
if (whileStatement != null) | |
{ | |
CheckCondition(whileStatement.Condition, consumer); | |
return; | |
} | |
var doStatement = element as IDoStatement; | |
if (doStatement != null) | |
{ | |
CheckCondition(doStatement.Condition, consumer); | |
return; | |
} | |
var forStatement = element as IForStatement; | |
if (forStatement != null) | |
{ | |
CheckCondition(forStatement.Condition, consumer); | |
return; | |
} | |
var conditionalExpression = element as IConditionalTernaryExpression; | |
if (conditionalExpression != null) | |
{ | |
CheckCondition(conditionalExpression.ConditionOperand, consumer); | |
return; | |
} | |
var exceptionFilterClause = element as IExceptionFilterClause; | |
if (exceptionFilterClause != null) | |
{ | |
CheckCondition(exceptionFilterClause.Condition, consumer); | |
return; | |
} | |
var patternGuardClause = element as IPatternGuardClause; | |
if (patternGuardClause != null) | |
{ | |
CheckCondition(patternGuardClause.Condition, consumer); | |
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
public void Run(ITreeNode element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) | |
{ | |
if (element is IIfStatement ifStatement) | |
{ | |
CheckCondition(ifStatement.Condition, consumer); | |
return; | |
} | |
if (element as IWhileStatement whileStatement) | |
{ | |
CheckCondition(whileStatement.Condition, consumer); | |
return; | |
} | |
if (element as IDoStatement doStatement) | |
{ | |
CheckCondition(doStatement.Condition, consumer); | |
return; | |
} | |
if (element as IForStatement forStatement) | |
{ | |
CheckCondition(forStatement.Condition, consumer); | |
return; | |
} | |
if (element as IConditionalTernaryExpression conditionalExpression) | |
{ | |
CheckCondition(conditionalExpression.ConditionOperand, consumer); | |
return; | |
} | |
if (element as IExceptionFilterClause exceptionFilterClause) | |
{ | |
CheckCondition(exceptionFilterClause.Condition, consumer); | |
return; | |
} | |
if (element as IPatternGuardClause patternGuardClause) | |
{ | |
CheckCondition(patternGuardClause.Condition, consumer); | |
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
public void Run(ITreeNode element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) | |
{ | |
switch (element) | |
{ | |
case IIfStatement ifStatement: | |
CheckCondition(ifStatement.Condition, consumer); | |
break; | |
case IWhileStatement whileStatement: | |
CheckCondition(whileStatement.Condition, consumer); | |
break; | |
case IDoStatement doStatement: | |
CheckCondition(doStatement.Condition, consumer); | |
break; | |
case IForStatement forStatement: | |
CheckCondition(forStatement.Condition, consumer); | |
break; | |
case IConditionalTernaryExpression conditionalExpression: | |
CheckCondition(conditionalExpression.ConditionOperand, consumer); | |
break; | |
case IExceptionFilterClause exceptionFilterClause: | |
CheckCondition(exceptionFilterClause.Condition, consumer); | |
break; | |
case IPatternGuardClause patternGuardClause: | |
CheckCondition(patternGuardClause.Condition, consumer); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment