Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Handle Possible Throw When Branching on Abstract Value #976

Closed
jwli229 opened this issue Sep 18, 2017 · 3 comments
Closed

Handle Possible Throw When Branching on Abstract Value #976

jwli229 opened this issue Sep 18, 2017 · 3 comments
Assignees

Comments

@jwli229
Copy link
Contributor

jwli229 commented Sep 18, 2017

let x = global.__abstract ? __abstract("boolean", "true") : true;
let y;
try {
  if (x) {
    y = 1;
    throw Error();
  } else {
    y = 0;
  }
}
catch(e) {
}

On a branch based on an abstract value where one of the branches throws and the other doesn't (example above), a fatal error occurs since the result of the evaluation is a PossiblyNormalCompletion.
Prepack should handle the join of the branches in this case.

@NTillmann
Copy link
Contributor

At the very least, the resulting error code should get some help text:
https://github.com/facebook/prepack/wiki/PP0001 is not yet populated.

@hermanventer
Copy link
Contributor

PP0001 is currently used for errors that are generated the old way, via reportIntrospectionError. These errors should instead be generated by calling handleError directly, with specific error codes and relevant source locations.

@jwli229
Copy link
Contributor Author

jwli229 commented Sep 26, 2017

I can change the error handling.

jwli229 added a commit that referenced this issue Sep 26, 2017
Issue: #976
Summary: Use handleError with a helpful message instead of reportIntrospectionError
Test Plan:
Use a test case to trigger the error and saw the error message.
jwli229 added a commit that referenced this issue Sep 26, 2017
Issue: #976
Summary: Use handleError with a helpful message instead of reportIntrospectionError
Test Plan:
Use a test case to trigger the error and saw the error message.
facebook-github-bot pushed a commit that referenced this issue Oct 3, 2017
Summary:
Issue: #976
 Use handleError with an message instead of reportIntrospectionError
Closes #997

Differential Revision: D5918135

Pulled By: JWZ2018

fbshipit-source-id: 41b432d17740741fa948e8546bc1ea2b99af9ed6
jwli229 added a commit that referenced this issue Oct 7, 2017
Summary:
Issue: #976
 Use handleError with an message instead of reportIntrospectionError
Closes #997

Differential Revision: D5918135

Pulled By: JWZ2018

fbshipit-source-id: 41b432d17740741fa948e8546bc1ea2b99af9ed6
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants