coderaiser/putout

Incorrect removing of an expression

Closed this issue · 2 comments

import {
    parse,
    transform,
} from 'putout';
import {print} from '@putout/printer';
import removeUnusedExpressions from '@putout/plugin-remove-unused-expressions';

const js = `a();!(function (s) {console.log(s);})();b()`;

const ast = parse(js);
transform(ast, js, {plugins: [
    ['remove-unused-expressions', removeUnusedExpressions],
]});
const min = print(ast);

console.log(min);

result

❯ node v.js
a();
b();

removed immediate function execution

Just fixed, is it works for you?

Yes, thank you so much)