mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-28 22:02:37 +01:00
Migrate Declaration to variant (#644)
Note this makes some structural choices that I'm not sure how popular they'll be... Most notably, I could remove `DeclarationKind` because I'm using `std::visit` and `Declaration::Visitor` in reality. I could go to `switch(tag())` instead, but I'm wondering if this approach will be well received for the separation of ownership. Alternatively, I could move `Declaration` around so that it actually implements the things like `TopLevel` -- I did feel weird with the old structure of typecheck.cpp implementing members of declaration.h, though.
This commit is contained in:
@@ -26,7 +26,7 @@ void ExecProgram(std::list<Declaration>* fs) {
|
||||
Env ct_top = p.values;
|
||||
std::list<Declaration> new_decls;
|
||||
for (const auto& decl : *fs) {
|
||||
new_decls.push_back(decl.TypeChecked(top, ct_top));
|
||||
new_decls.push_back(MakeTypeChecked(decl, top, ct_top));
|
||||
}
|
||||
if (tracing_output) {
|
||||
std::cout << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user