From 7886cc86c7ba5f25373d1ad6998241d47267d058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 8 Feb 2024 19:20:34 +0100 Subject: [PATCH 1/2] Set decorationState.[[Finished]] to true when decorator throws --- spec.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec.html b/spec.html index 609ef92f3e..8f57ea669a 100644 --- a/spec.html +++ b/spec.html @@ -24741,8 +24741,9 @@

1. Set _value_ to OrdinaryObjectCreate(%Object.prototype%). 1. Perform ! CreateDataPropertyOrThrow(_value_, *"get"*, _elementRecord_.[[Get]]). 1. Perform ! CreateDataPropertyOrThrow(_value_, *"set"*, _elementRecord_.[[Set]]). - 1. Let _newValue_ be ? Call(_decorator_, _decoratorReceiver_, « _value_, _context_ »). + 1. Let _newValue_ be Completion(Call(_decorator_, _decoratorReceiver_, « _value_, _context_ »)). 1. Set _decorationState_.[[Finished]] to *true*. + 1. ReturnIfAbrupt(_newValue_). 1. If _kind_ is ~field~, then 1. If IsCallable(_newValue_) is *true*, prepend _newValue_ to _elementRecord_.[[Initializers]]. 1. Else if _newValue_ is not *undefined*, throw a *TypeError* exception. From 84536dabe480fcf60996cf9cf8a8503dc8d11106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 8 Feb 2024 19:31:19 +0100 Subject: [PATCH 2/2] Also fix in ApplyDecoratorsToClassDefinition --- spec.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec.html b/spec.html index 8f57ea669a..24bbd3c303 100644 --- a/spec.html +++ b/spec.html @@ -24794,8 +24794,9 @@

1. Let _decoratorReceiver_ be _decoratorRecord_.[[Receiver]]. 1. Let _decorationState_ be the Record { [[Finished]]: *false* }. 1. Let _context_ be CreateDecoratorContextObject(~class~, _className_, _extraInitializers_, _decorationState_). - 1. Let _newDef_ be ? Call(_decorator_, _decoratorReceiver_, « _classDef_, _context_ »). + 1. Let _newDef_ be Completion(Call(_decorator_, _decoratorReceiver_, « _classDef_, _context_ »)). 1. Set _decorationState_.[[Finished]] to *true*. + 1. ReturnIfAbrupt(_newDef_). 1. If IsCallable(_newDef_) is *true*, then 1. Set _classDef_ to _newDef_. 1. Else if _newDef_ is not *undefined*, then