Closed lejenome closed 10 years ago
What is the rationale for this?
newcap
is supposed to complain regardless of context.
c(new Foo());
should not be rewritten to c(Foo());
this PR will fix the error
for example, on my app, fixmyjs rewrittes
document.body.dispatchEvent(new CustomEvent("blog-post-loaded"));
to
document.body.dispatchEvent(CustomEvent());
which is wrong
hope that explain what this PR is for, it has nothing to do with newcap
LGTM
this pull request fix this wrong rewrite
c(new Foo());
=>c(Foo());
it just checks ifparent.expression.type === 'CallExpression'
in caseparent.type === 'ExpressionStatement'
I'm not sure if there are other expression types inside ExpressionStatement that should be ignored too on newSideEffects rule