mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
add getter for static initializer blocks
This commit is contained in:
@@ -258,6 +258,11 @@ class ClassDefinition extends @class_definition, ClassOrInterface, AST::ValueNod
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ClassDefinition" }
|
||||
|
||||
/**
|
||||
* Gets a static initializer of this class, if any.
|
||||
*/
|
||||
BlockStmt getAStaticInitializerBlock() { result.getParent() = this }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -670,3 +670,6 @@ unionIndex
|
||||
| { stillMyUnion: true; } | 1 | MyUnion \| { yetAnotherType: true; } |
|
||||
| { stillMyUnion: true; } | 1 | { myUnion: true; } \| { stillMyUnion: true; } |
|
||||
| { yetAnotherType: true; } | 2 | MyUnion \| { yetAnotherType: true; } |
|
||||
getAStaticInitializerBlock
|
||||
| tst.ts:179:3:192:3 | class F ... \\n } | tst.ts:185:5:187:5 | static ... ;\\n } |
|
||||
| tst.ts:179:3:192:3 | class F ... \\n } | tst.ts:188:5:190:5 | static ... ;\\n } |
|
||||
|
||||
@@ -39,3 +39,7 @@ query predicate unknownType(Expr e, Type type) {
|
||||
query CallSignatureType abstractSignature() { result.isAbstract() }
|
||||
|
||||
query UnionType unionIndex(Type element, int i) { result.getElementType(i) = element }
|
||||
|
||||
query BlockStmt getAStaticInitializerBlock(ClassDefinition cls) {
|
||||
result = cls.getAStaticInitializerBlock()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user