@@ -635,6 +635,11 @@ function OutputStream(options) {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
PARENS(AST_Arrow, function(output){
|
||||||
|
var p = output.parent();
|
||||||
|
return p instanceof AST_PropAccess && p.expression === this;
|
||||||
|
});
|
||||||
|
|
||||||
// same goes for an object literal, because otherwise it would be
|
// same goes for an object literal, because otherwise it would be
|
||||||
// interpreted as a block of code.
|
// interpreted as a block of code.
|
||||||
PARENS(AST_Object, function(output){
|
PARENS(AST_Object, function(output){
|
||||||
|
|||||||
@@ -382,4 +382,22 @@ describe("Arrow functions", function() {
|
|||||||
assert(ast.body[0].definitions[0].value.argnames[0].names[0].value.names[1].expression instanceof uglify.AST_SymbolFunarg);
|
assert(ast.body[0].definitions[0].value.argnames[0].names[0].value.names[1].expression instanceof uglify.AST_SymbolFunarg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should handle arrow function with bind", function() {
|
||||||
|
function minify(code) {
|
||||||
|
return uglify.minify(code, {
|
||||||
|
fromString: true,
|
||||||
|
mangle: false
|
||||||
|
}).code;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.strictEqual(
|
||||||
|
minify(minify("test(((index) => { console.log(this, index); }).bind(this, 1));")),
|
||||||
|
"test((index=>{console.log(this,index)}).bind(this,1));"
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
|
minify(minify('test(((index) => { console.log(this, index); })["bind"](this, 1));')),
|
||||||
|
"test((index=>{console.log(this,index)}).bind(this,1));"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user