Record variant constructors for future use
This commit is contained in:
parent
d0b9c9702b
commit
0326bbe7f9
2 changed files with 19 additions and 0 deletions
|
@ -252,6 +252,7 @@ namespace bolt {
|
||||||
Var,
|
Var,
|
||||||
Class,
|
Class,
|
||||||
Type,
|
Type,
|
||||||
|
Constructor,
|
||||||
};
|
};
|
||||||
|
|
||||||
class Scope {
|
class Scope {
|
||||||
|
|
18
src/CST.cc
18
src/CST.cc
|
@ -140,6 +140,24 @@ namespace bolt {
|
||||||
{
|
{
|
||||||
auto Decl = static_cast<VariantDeclaration*>(X);
|
auto Decl = static_cast<VariantDeclaration*>(X);
|
||||||
addSymbol(Decl->Name->getCanonicalText(), Decl, SymbolKind::Type);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue