mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 15:01:05 +01:00
Feature call destructor for tuples and bug fixes for the destructor process (#2255)
This PR includes the following changes: * Added destruction process for tuples * Fix: In the current version only the last member of a object can be destroyed * Fix: In the current version, the destructor of the object is called after each method call I hope it is useful Co-authored-by: m new <michael.burzan@outlook.de> Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
co-authored by
m new
Geoff Romer
parent
4ea3e1951b
commit
cef93fba5e
@@ -152,6 +152,7 @@ static auto FinishActionKindFor(Action::Kind kind) -> FinishActionKind {
|
||||
return FinishActionKind::NoValue;
|
||||
case Action::Kind::ScopeAction:
|
||||
case Action::Kind::CleanUpAction:
|
||||
case Action::Kind::DestroyAction:
|
||||
return FinishActionKind::NeverCalled;
|
||||
}
|
||||
}
|
||||
@@ -313,11 +314,7 @@ void ActionStack::PopScopes(
|
||||
while (!todo_.IsEmpty() && llvm::isa<ScopeAction>(*todo_.Top())) {
|
||||
auto act = todo_.Pop();
|
||||
if (act->scope()) {
|
||||
if ((*act->scope()).DestructionState() <
|
||||
RuntimeScope::State::CleanUpped) {
|
||||
(*act->scope()).TransitState();
|
||||
cleanup_stack.push(std::move(act));
|
||||
}
|
||||
cleanup_stack.push(std::move(act));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user