Use the negation hack rather than parens for a toplevel function expression call
(only in !beautify mode)
This commit is contained in:
@@ -351,7 +351,9 @@ function OutputStream(options) {
|
|||||||
AST_Node.DEFMETHOD("print", function(stream, force_parens){
|
AST_Node.DEFMETHOD("print", function(stream, force_parens){
|
||||||
var self = this, generator = self._codegen;
|
var self = this, generator = self._codegen;
|
||||||
stream.push_node(self);
|
stream.push_node(self);
|
||||||
if (force_parens || self.needs_parens(stream)) {
|
var needs_parens = self.needs_parens(stream);
|
||||||
|
var fc = self instanceof AST_Function && !stream.option("beautify");
|
||||||
|
if (force_parens || (needs_parens && !fc)) {
|
||||||
stream.with_parens(function(){
|
stream.with_parens(function(){
|
||||||
self.add_comments(stream);
|
self.add_comments(stream);
|
||||||
self.add_source_map(stream);
|
self.add_source_map(stream);
|
||||||
@@ -359,6 +361,7 @@ function OutputStream(options) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
self.add_comments(stream);
|
self.add_comments(stream);
|
||||||
|
if (needs_parens && fc) stream.print("!");
|
||||||
self.add_source_map(stream);
|
self.add_source_map(stream);
|
||||||
generator(self, stream);
|
generator(self, stream);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user