Support class unions

This commit is contained in:
Taus
2021-05-27 14:01:21 +00:00
committed by GitHub
parent 97468a3935
commit e09a012064

View File

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