mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
- Only cache on `AttributeData` and not the parent entity. - Move `CreateGeneratedExpressionFromArgument` to `Expression.cs`. - Restructure the various `CreateGenerated` methods so child entities are created inside them (and therefore no need to expose child index logic). - Add locations to generated expressions. - Avoid linear lookup in `CompilationUnit.cs`. - Consolidate tests.
32 lines
817 B
Plaintext
32 lines
817 B
Plaintext
import csharp
|
|
|
|
private class RelevantElement extends Element {
|
|
RelevantElement() {
|
|
this.fromSource()
|
|
or
|
|
this.getLocation().(Assembly).getName() = "Assembly1"
|
|
}
|
|
}
|
|
|
|
private class RelevantAttribute extends RelevantElement, Attribute {
|
|
RelevantAttribute() {
|
|
this.fromSource()
|
|
or
|
|
this.getType().getName() = "CustomAttribute"
|
|
}
|
|
}
|
|
|
|
private class RelevantExpr extends RelevantElement, Expr { }
|
|
|
|
query predicate arguments(RelevantAttribute attribute, int index, RelevantExpr e) {
|
|
e = attribute.getArgument(index)
|
|
}
|
|
|
|
query predicate constructorArguments(RelevantAttribute attribute, int index, RelevantExpr e) {
|
|
e = attribute.getConstructorArgument(index)
|
|
}
|
|
|
|
query predicate namedArguments(RelevantAttribute attribute, string name, RelevantExpr e) {
|
|
e = attribute.getNamedArgument(name)
|
|
}
|