Revert to handling Expression by const pointer (#616)

This reverts the bulk of #606, #607, and #611, as well as parts of #588, #605, and #614.
This commit is contained in:
Geoff Romer
2021-07-01 12:33:16 -07:00
committed by GitHub
parent e7a1093eb9
commit 047dfd692e
12 changed files with 235 additions and 245 deletions
@@ -8,23 +8,23 @@
namespace Carbon {
auto MakeFunDef(int line_num, std::string name, Expression ret_type,
Expression param_pattern, const Statement* body)
auto MakeFunDef(int line_num, std::string name, const Expression* ret_type,
const Expression* param_pattern, const Statement* body)
-> FunctionDefinition {
FunctionDefinition f;
f.line_num = line_num;
f.name = std::move(name);
f.return_type = std::move(ret_type);
f.param_pattern = std::move(param_pattern);
f.return_type = ret_type;
f.param_pattern = param_pattern;
f.body = body;
return f;
}
void PrintFunDefDepth(const FunctionDefinition& f, int depth) {
std::cout << "fn " << f.name << " ";
PrintExp(&f.param_pattern);
PrintExp(f.param_pattern);
std::cout << " -> ";
PrintExp(&f.return_type);
PrintExp(f.return_type);
if (f.body) {
std::cout << " {" << std::endl;
PrintStatement(f.body, depth);