tc39 / proposal-static-class-features

The static parts of new class features, in a separate proposal
https://arai-a.github.io/ecma262-compare/?pr=1668
127 stars 27 forks source link

ClassDefinitionEvaluation does not correctly restore outerPrivateEnvironment. #68

Closed rbuckton closed 3 years ago

rbuckton commented 3 years ago

Per the spec text here: https://arai-a.github.io/ecma262-compare/?pr=1668&id=sec-runtime-semantics-classdefinitionevaluation

According to this algorithm, abrupt completions on steps 33.a. or 34.a. cause the algorithm to return before the execution context's PrivateEnvironment is reset:

image

The ? shorthand for ReturnIfAbrupt should not be used here as it short-circuits restoring the PrivateEnvironment. Instead, we should be storing the result, restoring the PrivateEnvironment, and then use ReturnIfAbrupt.

ljharb commented 3 years ago

This would be a great review to file on https://github.com/tc39/ecma262/pull/1668

rbuckton commented 3 years ago

Fair point, I was deep in updating the static {} proposal and just wanted to make sure I captured the discrepancy.

rbuckton commented 3 years ago

I've moved this to a review comment on the pr.