C#: Add lambda attributes test cases.

This commit is contained in:
Michael Nebel
2022-01-28 09:19:03 +01:00
parent 7b3ba3cb96
commit 6ee30843bb
2 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
allAttributes
| LambdaAttributes.cs:14:20:14:26 | [Example(...)] | LambdaAttributes.cs:14:28:14:28 | 1 | Parameter |
| LambdaAttributes.cs:15:18:15:24 | [Example(...)] | LambdaAttributes.cs:15:26:15:26 | 2 | LambdaExpr |
| LambdaAttributes.cs:16:26:16:32 | [return: Example(...)] | LambdaAttributes.cs:16:34:16:34 | 3 | LambdaExpr |
lambdaAttributes
| LambdaAttributes.cs:15:18:15:24 | [Example(...)] | LambdaAttributes.cs:15:26:15:26 | 2 | LambdaAttributes.cs:15:17:15:52 | (...) => ... |
| LambdaAttributes.cs:16:26:16:32 | [return: Example(...)] | LambdaAttributes.cs:16:34:16:34 | 3 | LambdaAttributes.cs:16:17:16:60 | (...) => ... |

View File

@@ -0,0 +1,11 @@
import csharp
query predicate allAttributes(Attribute a, Expr arg, string c) {
a.fromSource() and
arg = a.getArgument(0) and
c = a.getTarget().(Element).getAPrimaryQlClass()
}
query predicate lambdaAttributes(Attribute a, Expr arg, LambdaExpr l) {
allAttributes(a, arg, _) and a.getTarget() = l
}