Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bugs in return type of CatchClauseEvaluation algorithm #2920

Closed
wants to merge 1 commit into from

Conversation

jhnaldo
Copy link
Contributor

@jhnaldo jhnaldo commented Sep 29, 2022

We found the return type bug in the syntax-directed operation: 14.15.2 Runtime semantics: CatchClauseEvaluation via ESMeta type analyzer.

Currently, the type of CatchClauseEvaluation is defined as follows:

       Runtime Semantics: CatchClauseEvaluation (
         _thrownValue_: an ECMAScript language value,
       ): either a normal completion containing an ECMAScript language value or an abrupt completion

However, I think its return type should contain a normal completion containing ~empty~.

In step 7 for Catch : `catch` `(` CatchParameter `)` Block case, the variable B stores the result of Evaluation of |Block|. According to 14.2.2 Runtime Semantics: Evaluation, the variable B might be a normal completion containing ~empty~. Then, step 9 returns the value stored in the variable B.

Similarly, in step 1 for Catch : `catch` Block case, it directly returns the result of Evaluation of |Block|.

Therefore, I suggest extending its return type as follows:

         Runtime Semantics: CatchClauseEvaluation (
           _thrownValue_: an ECMAScript language value,
-        ): either a normal completion containing an ECMAScript language value or an abrupt completion
+        ): either a normal completion containing either an ECMAScript language value or ~empty~, or an abrupt completion

@jhnaldo jhnaldo closed this Sep 29, 2022
@jhnaldo jhnaldo deleted the fix-ret-ty-CatchClauseEvaluation branch September 29, 2022 12:56
@jhnaldo jhnaldo restored the fix-ret-ty-CatchClauseEvaluation branch September 29, 2022 12:59
@jhnaldo jhnaldo reopened this Sep 29, 2022
@jhnaldo jhnaldo closed this Sep 29, 2022
@jhnaldo jhnaldo deleted the fix-ret-ty-CatchClauseEvaluation branch September 29, 2022 13:04
@jhnaldo
Copy link
Contributor Author

jhnaldo commented Sep 29, 2022

I will request a new PR.

@ljharb
Copy link
Member

ljharb commented Sep 29, 2022

What was wrong with this one?

@jhnaldo
Copy link
Contributor Author

jhnaldo commented Sep 29, 2022

Since our tool detected other similar bugs, I wanted to update this PR. But, I accidentally removed my branch. So, I reopened another PR with other detected bugs: #2924.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants