Added new queries for switch statement anomalies
This commit is contained in:
Родитель
c218734f72
Коммит
d0f341b322
|
@ -5,7 +5,6 @@
|
|||
Having more than one default part is semantically correct in X++
|
||||
but makes maintenance much more difficult :)
|
||||
|
||||
(: Note: This does not find references updated with byref parameters :)
|
||||
(: @Language Xpp :)
|
||||
(: @Category Informational :)
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
(: Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license. :)
|
||||
|
||||
(: Find switch statements that have case entries that are not constants :)
|
||||
(: There is nothing semantically incorrect about this, except that it
|
||||
may have maintainablity problems :)
|
||||
|
||||
(: @Language Xpp :)
|
||||
(: @Category Informational :)
|
||||
<SwitchNonConstantCases>
|
||||
{
|
||||
for $a in /(Class | Table | Form | Query)
|
||||
for $sw in $a//SwitchStatement
|
||||
for $cvs in $sw/CaseValues
|
||||
where not( $cvs/(IntLiteralExpression | StringLiteralExpression | Int64LiteralExpression | RealLiteralExpression | QualifiedStaticFieldExpression | Intrinsic))
|
||||
return <SwitchNonConstantCase Artifact='{$a/@Artifact}'
|
||||
StartLine='{$sw/@StartLine}' StartCol='{$sw/@StartCol}' EndLine='{$sw/@EndLine}' EndCol='{$sw/@EndCol}'>
|
||||
{
|
||||
(: $cvs :)
|
||||
}
|
||||
</SwitchNonConstantCase>
|
||||
}
|
||||
</SwitchNonConstantCases>
|
Загрузка…
Ссылка в новой задаче