[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:
Dave Abrahams
2021-02-27 13:32:03 -08:00
committed by GitHub
parent cd57024042
commit 2205fd52ce
14 changed files with 191 additions and 210 deletions
@@ -19,10 +19,9 @@ struct FunctionDefinition {
};
auto MakeFunDef(int line_num, std::string name, Expression* ret_type,
Expression* param, Statement* body)
-> struct FunctionDefinition*;
void PrintFunDef(struct FunctionDefinition*);
void PrintFunDefDepth(struct FunctionDefinition*, int);
Expression* param, Statement* body) -> FunctionDefinition*;
void PrintFunDef(const FunctionDefinition*);
void PrintFunDefDepth(const FunctionDefinition*, int);
} // namespace Carbon