Record variant constructors for future use

This commit is contained in:
Sam Vervaeck 2023-06-05 15:53:24 +02:00
parent d0b9c9702b
commit 0326bbe7f9
Signed by: samvv
SSH key fingerprint: SHA256:dIg0ywU1OP+ZYifrYxy8c5esO72cIKB+4/9wkZj1VaY
2 changed files with 19 additions and 0 deletions

View file

@ -252,6 +252,7 @@ namespace bolt {
Var,
Class,
Type,
Constructor,
};
class Scope {

View file

@ -140,6 +140,24 @@ namespace bolt {
{
auto Decl = static_cast<VariantDeclaration*>(X);
addSymbol(Decl->Name->getCanonicalText(), Decl, SymbolKind::Type);
for (auto Member: Decl->Members) {
switch (Member->getKind()) {
case NodeKind::TupleVariantDeclarationMember:
{
auto T = static_cast<TupleVariantDeclarationMember*>(Member);
addSymbol(T->Name->getCanonicalText(), Decl, SymbolKind::Constructor);
break;
}
case NodeKind::RecordVariantDeclarationMember:
{
auto R = static_cast<RecordVariantDeclarationMember*>(Member);
addSymbol(R->Name->getCanonicalText(), Decl, SymbolKind::Constructor);
break;
}
default:
ZEN_UNREACHABLE
}
}
break;
}
default: