mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-03 09:25:52 +01:00
Migrate PrimitiveOperator to value semantics (#606)
* Make PrimitiveOperator.arguments a value. * Make operator factory functions take Expressions by value.
This commit is contained in:
@@ -746,11 +746,11 @@ void StepExp() {
|
||||
frame->todo.Push(MakeValAct(Value::MakeBoolVal(exp->GetBoolean())));
|
||||
break;
|
||||
case ExpressionKind::PrimitiveOp:
|
||||
if (exp->GetPrimitiveOperator().arguments->size() > 0) {
|
||||
if (exp->GetPrimitiveOperator().arguments.size() > 0) {
|
||||
// { {op(e :: es) :: C, E, F} :: S, H}
|
||||
// -> { e :: op([] :: es) :: C, E, F} :: S, H}
|
||||
frame->todo.Push(
|
||||
MakeExpAct(exp->GetPrimitiveOperator().arguments->front()));
|
||||
MakeExpAct(&exp->GetPrimitiveOperator().arguments.front()));
|
||||
act->pos++;
|
||||
} else {
|
||||
// { {v :: op(]) :: C, E, F} :: S, H}
|
||||
@@ -1205,11 +1205,11 @@ void HandleValue() {
|
||||
}
|
||||
case ExpressionKind::PrimitiveOp: {
|
||||
if (act->pos !=
|
||||
static_cast<int>(exp->GetPrimitiveOperator().arguments->size())) {
|
||||
static_cast<int>(exp->GetPrimitiveOperator().arguments.size())) {
|
||||
// { {v :: op(vs,[],e,es) :: C, E, F} :: S, H}
|
||||
// -> { {e :: op(vs,v,[],es) :: C, E, F} :: S, H}
|
||||
const Expression* arg =
|
||||
(*exp->GetPrimitiveOperator().arguments)[act->pos];
|
||||
&exp->GetPrimitiveOperator().arguments[act->pos];
|
||||
frame->todo.Pop(1);
|
||||
frame->todo.Push(MakeExpAct(arg));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user