From b31ea30e852bb7a4ae0f57a3b2b7e4dfa1b9bc7c Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Sat, 16 Oct 2021 22:22:52 +0200 Subject: [PATCH] better support for getType on super --- ql/src/codeql_ql/ast/Ast.qll | 3 +-- ql/test/type/type.expected | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ql/src/codeql_ql/ast/Ast.qll b/ql/src/codeql_ql/ast/Ast.qll index ae0934f3d62..06713d30745 100644 --- a/ql/src/codeql_ql/ast/Ast.qll +++ b/ql/src/codeql_ql/ast/Ast.qll @@ -1765,8 +1765,7 @@ class Super extends TSuper, Expr { override string getAPrimaryQlClass() { result = "Super" } override Type getType() { - exists(TypeExpr te | ref.getChild(0) = toQL(te) | result = te.getResolvedType()) - // TODO: Also resolve the type when there is no TypeExpr. + exists(MemberCall call | call.getBase() = this | result = call.getTarget().getDeclaringType()) } } diff --git a/ql/test/type/type.expected b/ql/test/type/type.expected index ee758234b31..29f6076374f 100644 --- a/ql/test/type/type.expected +++ b/ql/test/type/type.expected @@ -50,4 +50,5 @@ | Test.qll:24:24:24:33 | Super | Test.qll:15:1:19:1 | Base | | Test.qll:24:24:24:39 | MemberCall | file://:0:0:0:0 | int | | Test.qll:26:16:26:21 | result | file://:0:0:0:0 | int | +| Test.qll:26:25:26:29 | Super | Test.qll:15:1:19:1 | Base | | Test.qll:26:25:26:35 | MemberCall | file://:0:0:0:0 | int |