tc39/proposal-decorators

Dangling decorationState.[[Finished]] when throwing

camillobruni opened this issue · 9 comments

If a decorator throws, we don't set decorationState.[[Finished]] = true.
This means that if addInitializerClosure is used later, it can still be called without throwing which might be a bit misleading.

This applies to the two following steps:

  • 15.7.6 ApplyDecoratorsToElementDefinition, step 5.h
  • 15.7.7 ApplyDecoratorsToClassDefinition , step 1.c

@ljharb would this be a normative change to fix? Definitely was not the intended behavior

Yes, but it doesn't seem like a controversial one.

I also stumbled upon this in the Babel implementation, I'd love for it to be changed.

It definitely will, I'll propose it at the upcoming plenary, just needed to figure out if it was normative

You could probably fit it into today’s plenary session if you’re available.

Unfortunately I am not available today, my schedule is packed at the moment 😕

@pzuraq I can present it for you of you want (this change)

@nicolo-ribaudo I don't have a PR or slides for it unfortunately. The change is just to make the procedure that calls decorators be an explicit completion that catches the error and sets the didDecorate state to true, so it can't be called again. It's not a huge change, I just don't have time to handle it today.

Ok well, I opened pzuraq/ecma262#13 in the meanwhile. If you change your mind and you are ok with me presenting just ping me :) (this change is so small that the PR description is enough, it doesn't need slides).