parent
054330df3f
commit
dd36b1965a
|
|
@ -1276,9 +1276,16 @@ function parse($TEXT, options) {
|
||||||
case "(":
|
case "(":
|
||||||
next();
|
next();
|
||||||
var ex = expression(true);
|
var ex = expression(true);
|
||||||
|
[].push.apply(start.comments_before, ex.start.comments_before);
|
||||||
|
ex.start.comments_before = start.comments_before;
|
||||||
|
start.comments_after = ex.start.comments_after;
|
||||||
ex.start = start;
|
ex.start = start;
|
||||||
ex.end = S.token;
|
|
||||||
expect(")");
|
expect(")");
|
||||||
|
var end = prev();
|
||||||
|
end.comments_before = ex.end.comments_before;
|
||||||
|
[].push.apply(ex.end.comments_after, end.comments_after);
|
||||||
|
end.comments_after = ex.end.comments_after;
|
||||||
|
ex.end = end;
|
||||||
return subscripts(ex, allow_calls);
|
return subscripts(ex, allow_calls);
|
||||||
case "[":
|
case "[":
|
||||||
return subscripts(array_(), allow_calls);
|
return subscripts(array_(), allow_calls);
|
||||||
|
|
|
||||||
|
|
@ -293,3 +293,16 @@ unary: {
|
||||||
bar();
|
bar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_2629: {
|
||||||
|
options = {
|
||||||
|
side_effects: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
/*@__PURE__*/ f1();
|
||||||
|
(/*@__PURE__*/ f2)();
|
||||||
|
/*@__PURE__*/ (f3());
|
||||||
|
(/*@__PURE__*/ f4());
|
||||||
|
}
|
||||||
|
expect: {}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -207,4 +207,16 @@ describe("Comment", function() {
|
||||||
if (result.error) throw result.error;
|
if (result.error) throw result.error;
|
||||||
assert.strictEqual(result.code, code);
|
assert.strictEqual(result.code, code);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should preserve comments around IIFE", function() {
|
||||||
|
var result = uglify.minify("/*a*/(/*b*/function(){/*c*/}/*d*/)/*e*/();", {
|
||||||
|
compress: false,
|
||||||
|
mangle: false,
|
||||||
|
output: {
|
||||||
|
comments: "all",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (result.error) throw result.error;
|
||||||
|
assert.strictEqual(result.code, "/*a*/ /*b*/(function(){/*c*/}/*d*/ /*e*/)();");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user