mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 06:11:05 +01:00
Support for as operator and user-defined As impls. (#1476)
This commit is contained in:
@@ -176,6 +176,15 @@ auto ActionStack::Spawn(std::unique_ptr<Action> child, RuntimeScope scope)
|
||||
return Success();
|
||||
}
|
||||
|
||||
auto ActionStack::ReplaceWith(std::unique_ptr<Action> replacement)
|
||||
-> ErrorOr<Success> {
|
||||
std::unique_ptr<Action> old = todo_.Pop();
|
||||
CARBON_CHECK(replacement->kind() == old->kind())
|
||||
<< "ReplaceWith can't change action kind";
|
||||
todo_.Push(std::move(replacement));
|
||||
return Success();
|
||||
}
|
||||
|
||||
auto ActionStack::RunAgain() -> ErrorOr<Success> {
|
||||
Action& action = *todo_.Top();
|
||||
action.set_pos(action.pos() + 1);
|
||||
|
||||
Reference in New Issue
Block a user