if (stat instanceof AST_SimpleStatement) {
stat.body = (function transform(thing) {
return thing.transform(new TreeTransformer(function(node){
+ if (node instanceof AST_New
+ && node.expression instanceof AST_Call
+ && node.expression.expression instanceof AST_Function) {
+ return node;
+ }
if (node instanceof AST_Call && node.expression instanceof AST_Function) {
return make_node(AST_UnaryPrefix, node, {
operator: "!",
}();
}
}
+
+negate_iife_issue_1073: {
+ options = {
+ negate_iife: true,
+ sequences: true,
+ conditionals: true,
+ };
+ input: {
+ new (function(a) {
+ return function Foo() {
+ this.x = a;
+ console.log(this);
+ };
+ }(7))();
+ }
+ expect: {
+ new (function(a) {
+ return function Foo() {
+ this.x = a,
+ console.log(this);
+ };
+ }(7))();
+ }
+}