From 03d989e005ee49a4262062d1e542b36b1ae2a4e3 Mon Sep 17 00:00:00 2001 From: rbuckton Date: Wed, 10 Apr 2024 18:57:47 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20tc39/pro?= =?UTF-8?q?posal-explicit-resource-management@2fea3440f132925ca62e4c6d6e29?= =?UTF-8?q?27aed8fa1674=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 ab439ad..e1b08ea 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. 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.
+
  1. Let needsAwait be false.
  2. Let hasAwaited be false.
  3. For each element 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.