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

finally always returns value #24

Closed
bloody-ux opened this issue Apr 19, 2019 · 0 comments
Closed

finally always returns value #24

bloody-ux opened this issue Apr 19, 2019 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@bloody-ux
Copy link
Contributor

Sval doesn't deal with finally statement correctly, it doesn't check whether there's RETURN value before return, which leads below case failed.

Test case:

const Sval = require('sval')

const interpreter = new Sval({ ecmaVer: 8 })

interpreter.run(`
    function T() {
      try {
        return 7;
      } catch (ex) {
        return 5;
      } finally {
        
      }
    }

    console.log(T());
    exports.end = true;
`)

module.exports = 'End: ' + interpreter.exports.end

Expected result:

7

Actual result:

undefined

Cause: always returns value. needing to check whether there's a RETURN.

image

@Siubaak Siubaak self-assigned this Apr 20, 2019
@Siubaak Siubaak added the bug Something isn't working label Apr 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants