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

Bad instrumentation of constructor super-call with spread operator #83

Closed
mhelvens opened this issue Apr 24, 2015 · 1 comment
Closed
Labels

Comments

@mhelvens
Copy link

Have a look at this minimal ES6 example code:

export default class MyError extends Error {
    constructor(...args) {
        super(...args);
    }
}

After Wallaby instruments this code, it looks like this:

$_$wp(1);
export default class MyError extends Error {
    constructor(...args) {
        super(($_$wf(1), $_$w(1, 0), ...args));
    }
}

That super line now has a syntax error, because the spread operator ... is not expected in a comma expression. You probably want to check for this and output something like this instead:

super(...($_$wf(1), $_$w(1, 0), args));

I'd create a pull request, but I'm not sure where you're hosting your code.

@ArtemGovorov
Copy link
Member

Awesome find, thanks! Fixed like you have suggested.

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

No branches or pull requests

2 participants