From f687516c8d0c2022d39b7c0ceb178e0e45abb104 Mon Sep 17 00:00:00 2001 From: rbuckton Date: Wed, 10 Apr 2024 18:33:08 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20tc39/pro?= =?UTF-8?q?posal-explicit-resource-management@731fdab9916da64257d0494a8cf3?= =?UTF-8?q?e4bd34322810=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pr/219/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr/219/index.html b/pr/219/index.html index fdaaa0d..ab439ad 100644 --- a/pr/219/index.html +++ b/pr/219/index.html @@ -3528,7 +3528,7 @@

2.1.7 Dispose ( V, hint, <

2.1.8 DisposeResources ( disposeCapability, completion )

The abstract operation DisposeResources takes arguments disposeCapability (a DisposeCapability Record) and completion (a Completion Record) and returns a Completion Record. It performs the following steps when called:

-
  1. Let needsAwait be false.
  2. For each resource of disposeCapability.[[DisposableResourceStack]], in reverse list order, do
    1. Let value be resource.[[ResourceValue]].
    2. Let hint be resource.[[Hint]].
    3. Let method be resource.[[DisposeMethod]].
    4. If hint is sync-dispose and needsAwait is true, then
      1. Perform ! Await(undefined).
      2. Set needsAwait to false.
    5. If method is not undefined, then
      1. If needsAwait is true, then
        1. Perform ! Await(undefined).
        2. Set needsAwait to false.
      2. Let result be Completion(Call(method, value)).
      3. If result is a normal completion and hint is async-dispose, then
        1. Set result to Completion(Await(result.[[Value]])).
      4. If result is a throw completion, then
        1. If completion is a throw completion, then
          1. Set result to result.[[Value]].
          2. Let suppressed be completion.[[Value]].
          3. Let error be a newly created SuppressedError object.
          4. Perform CreateNonEnumerableDataPropertyOrThrow(error, "error", result).
          5. Perform CreateNonEnumerableDataPropertyOrThrow(error, "suppressed", suppressed).
          6. Set completion to ThrowCompletion(error).
        2. Else,
          1. Set completion to result.
      5. Else,
        1. Assert: hint is async-dispose.
        2. Set needsAwait to true.
        3. NOTE: This can only indicate a case where either null or undefined was the initialized value of an await using declaration.
  3. If needsAwait is true, then
    1. Perform ! Await(undefined).
  4. NOTE: After disposeCapability has been disposed, it will never be used again. The contents of disposeCapability.[[DisposableResourceStack]] can be discarded in implementations, such as by garbage collection, at this point.
  5. Set disposeCapability.[[DisposableResourceStack]] to a new empty List.
  6. Return completion.
+
  1. Let needsAwait be false.
  2. Let hasAwaited be false.
  3. For each resource of disposeCapability.[[DisposableResourceStack]], in reverse list order, do
    1. Let value be resource.[[ResourceValue]].
    2. Let hint be resource.[[Hint]].
    3. Let method be resource.[[DisposeMethod]].
    4. If hint is sync-dispose and needsAwait is true and hasAwaited is false, then
      1. Perform ! Await(undefined).
      2. Set needsAwait to false.
      3. Set hasAwaited to false.
    5. If method is not undefined, then
      1. Let result be Completion(Call(method, value)).
      2. If result is a normal completion and hint is async-dispose, then
        1. Set result to Completion(Await(result.[[Value]])).
        2. Set hasAwaited to true.
      3. If result is a throw completion, then
        1. If completion is a throw completion, then
          1. Set result to result.[[Value]].
          2. Let suppressed be completion.[[Value]].
          3. Let error be a newly created SuppressedError object.
          4. Perform CreateNonEnumerableDataPropertyOrThrow(error, "error", result).
          5. Perform CreateNonEnumerableDataPropertyOrThrow(error, "suppressed", suppressed).
          6. Set completion to ThrowCompletion(error).
        2. Else,
          1. Set completion to result.
      4. Else,
        1. Assert: hint is async-dispose.
        2. Set needsAwait to true.
        3. NOTE: This can only indicate a case where either null or undefined was the initialized value of an await using declaration.
  4. If needsAwait is true and hasAwaited is false, then
    1. Perform ! Await(undefined).
  5. NOTE: After disposeCapability has been disposed, it will never be used again. The contents of disposeCapability.[[DisposableResourceStack]] can be discarded in implementations, such as by garbage collection, at this point.
  6. Set disposeCapability.[[DisposableResourceStack]] to a new empty List.
  7. Return completion.