Skip to content

Commit

Permalink
[explicit-resource-management] Dispose the stack before disposal
Browse files Browse the repository at this point in the history
This CL adds the requirement of having disposed stack before
calling DisposeResources on the DisposableStack.

Bug: 42203506
Change-Id: I515a5f23e609fdd9448cebc4cd71b0176c86cf99
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6298949
Reviewed-by: Shu-yu Guo <[email protected]>
Commit-Queue: Rezvan Mahdavi Hezaveh <[email protected]>
Cr-Commit-Position: refs/heads/main@{#98902}
  • Loading branch information
rmahdav authored and [email protected] committed Feb 25, 2025
1 parent 15e6027 commit d6d7548
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (C) 2025 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: Re-entry to a disposable stack should do nothing.
includes: [compareArray.js]
features: [explicit-resource-management]
---*/

let values = [];

(function TestDisposableStackReEntry() {
let stack = new DisposableStack();
stack.use({
[Symbol.dispose]() {
values.push(42);
stack.dispose();
}
});
stack.dispose();
})();
assert.compareArray(values, [42]);

0 comments on commit d6d7548

Please sign in to comment.