mirror of
https://github.com/github/codeql.git
synced 2026-02-08 03:01:10 +01:00
Support super with instanceof
This commit is contained in:
@@ -754,6 +754,11 @@ class Class extends TClass, TypeDeclaration, ModuleDeclaration {
|
||||
*/
|
||||
TypeExpr getASuperType() { toQL(result) = cls.getExtends(_) }
|
||||
|
||||
/**
|
||||
* Gets a type referenced in the `instanceof` part of the class declaration.
|
||||
*/
|
||||
TypeExpr getAnInstanceofType() { toQL(result) = cls.getInstanceof(_) }
|
||||
|
||||
/** Gets the type that this class is defined to be an alias of. */
|
||||
TypeExpr getAliasType() { toQL(result) = cls.getChild(_).(QL::TypeAliasBody).getChild() }
|
||||
|
||||
|
||||
@@ -79,10 +79,11 @@ private module Cached {
|
||||
)
|
||||
or
|
||||
// super calls
|
||||
exists(Super sup, ClassType type |
|
||||
exists(Super sup, ClassType type, Type supertype |
|
||||
mc.getBase() = sup and
|
||||
sup.getEnclosingPredicate().(ClassPredicate).getParent().getType() = type and
|
||||
p = type.getASuperType().getClassPredicate(mc.getMemberName(), mc.getNumberOfArguments())
|
||||
supertype in [type.getASuperType(), type.getAnInstanceofType()] and
|
||||
p = supertype.getClassPredicate(mc.getMemberName(), mc.getNumberOfArguments())
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,8 @@ class ClassType extends Type, TClass {
|
||||
|
||||
override Type getASuperType() { result = decl.getASuperType().getResolvedType() }
|
||||
|
||||
Type getAnInstanceofType() { result = decl.getAnInstanceofType().getResolvedType() }
|
||||
|
||||
override Type getAnInternalSuperType() {
|
||||
result.(ClassCharType).getClassType() = this
|
||||
or
|
||||
|
||||
Reference in New Issue
Block a user