mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-28 22:02:37 +01:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user