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(_) + } } /**