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

Ensure that the "skipFinallyBlock" variable is set even if CatchBlock is null #90

Merged
merged 1 commit into from
Mar 7, 2017

Conversation

kpreisser
Copy link
Collaborator

@kpreisser kpreisser commented Mar 5, 2017

Follow-Up commit for c773bf2:
Generate a catch block even if this.CatchClause is null (and rethrow the exception in this case), to ensure the skipFinallyBlock variable is set in every case, not only when the script has a catch clause. This fixes the remaining issue of #85 where a finally block would execute if the script only has a try-finally block instead of try-catch-finally and the Exception is not catchable in JS.

Notes:

  • Currently, the TryFinallyStatement generates a catch (Exception ex) clause. In theory, the CLR allows to throw any object, nut just Exception, so to be safe we might want to change the emit to catch (object o) and change ScriptEngine.CanCatchException(Exception) to accept an object parameter.
  • I think the skipFinallyBlock variable could be changed to use a temporary variable.

Thanks!

@paulbartrum paulbartrum merged commit 6fadfd3 into paulbartrum:master Mar 7, 2017
@paulbartrum
Copy link
Owner

I added some unit tests, but otherwise merged your changes in wholesale. Thanks! :-)

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