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:
pmqtt
2022-11-04 12:13:24 -07:00
committed by GitHub
co-authored by m new Geoff Romer
parent 4ea3e1951b
commit cef93fba5e
12 changed files with 311 additions and 89 deletions
+2 -5
View File
@@ -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));
}
}
}