Eliminate MakeUnOp and MakeBinOp (#622)

This ensures that the factory functions correspond 1:1 with expression kinds, and MakeOp covers their use cases with minimal syntactic overhead now that it can take initializer list arguments.
This commit is contained in:
Geoff Romer
2021-07-07 10:49:02 -07:00
committed by GitHub
parent 696f8f1fce
commit 7218e8a69e
4 changed files with 14 additions and 35 deletions
-17
View File
@@ -130,23 +130,6 @@ auto Expression::MakeOp(int line_num, enum Operator op,
return e;
}
auto Expression::MakeUnOp(int line_num, enum Operator op, const Expression* arg)
-> const Expression* {
auto* e = new Expression();
e->line_num = line_num;
e->value = PrimitiveOperator({.op = op, .arguments = {arg}});
return e;
}
auto Expression::MakeBinOp(int line_num, enum Operator op,
const Expression* arg1, const Expression* arg2)
-> const Expression* {
auto* e = new Expression();
e->line_num = line_num;
e->value = PrimitiveOperator({.op = op, .arguments = {arg1, arg2}});
return e;
}
auto Expression::MakeCall(int line_num, const Expression* fun,
const Expression* arg) -> const Expression* {
auto* e = new Expression();