mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 19:58:11 +00:00
[executable semantics] class-ify Declaration (#307)
* [executable semantics] class-ify Declaration NFC (no functional change). Proof of concept that we can simplify code by replacing unions with safer, more regular types. Hand-rolled existentials (type-erasing CoW wrappers) are a follow-on step that will further simplify usage. Began adding `const` where possible, and replacing `std::string*` with `std::string`. Most `const`s can disappear as we replace reference semantics with value semantics, but in the meantime it's an important step in the right direction.
This commit is contained in:
1 parent
cd57024042
commit
2205fd52ce
14 files changed
+191
-210
No files matched your search
@@ -20,7 +20,7 @@ auto MakeFunDef(int line_num, std::string name, Expression* ret_type,
|
||||
return f;
|
||||
}
|
||||
|
||||
void PrintFunDefDepth(struct FunctionDefinition* f, int depth) {
|
||||
void PrintFunDefDepth(const FunctionDefinition* f, int depth) {
|
||||
std::cout << "fn " << f->name << " ";
|
||||
PrintExp(f->param_pattern);
|
||||
std::cout << " -> ";
|
||||
@@ -34,6 +34,6 @@ void PrintFunDefDepth(struct FunctionDefinition* f, int depth) {
|
||||
}
|
||||
}
|
||||
|
||||
void PrintFunDef(struct FunctionDefinition* f) { PrintFunDefDepth(f, -1); }
|
||||
void PrintFunDef(const FunctionDefinition* f) { PrintFunDefDepth(f, -1); }
|
||||
|
||||
} // namespace Carbon
|
||||
Reference in new issue
Block a user