From e09a01206483fb050c2d0a870e6cef149ea5e150 Mon Sep 17 00:00:00 2001 From: Taus Date: Thu, 27 May 2021 14:01:21 +0000 Subject: [PATCH] Support class unions --- ql/src/codeql_ql/ast/Ast.qll | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ql/src/codeql_ql/ast/Ast.qll b/ql/src/codeql_ql/ast/Ast.qll index 229bfa24c8b..78ad68225c3 100644 --- a/ql/src/codeql_ql/ast/Ast.qll +++ b/ql/src/codeql_ql/ast/Ast.qll @@ -218,6 +218,8 @@ class Type extends TType, AstNode { result.(InlineCast).getType() = this or result.(Class).getAliasType() = this + or + result.(Class).getUnionMember() = this } } @@ -328,6 +330,11 @@ class Class extends TClass, AstNode, ModuleMember { Type getAliasType() { toGenerated(result) = cls.getChild(_).(Generated::TypeAliasBody).getChild() } + + /** Gets the type of one of the members that this class is defined to be a union of. */ + Type getUnionMember() { + toGenerated(result) = cls.getChild(_).(Generated::TypeUnionBody).getChild(_) + } } /**