parent
57ab92ed33
commit
e623668183
|
@ -2106,7 +2106,11 @@ function printMemberChain(path, options, print) {
|
||||||
// .d()
|
// .d()
|
||||||
// .e
|
// .e
|
||||||
|
|
||||||
// The first group is the first node followed by as many CallExpression as possible
|
// The first group is the first node followed by
|
||||||
|
// - as many CallExpression as possible
|
||||||
|
// < fn()()() >.something()
|
||||||
|
// - then, as many MemberExpression as possible but the last one
|
||||||
|
// < this.items >.something()
|
||||||
var groups = [];
|
var groups = [];
|
||||||
var currentGroup = [printedNodes[0]];
|
var currentGroup = [printedNodes[0]];
|
||||||
var i = 1;
|
var i = 1;
|
||||||
|
@ -2117,6 +2121,14 @@ function printMemberChain(path, options, print) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (; i + 1 < printedNodes.length; ++i) {
|
||||||
|
if (printedNodes[i].node.type === "MemberExpression" &&
|
||||||
|
printedNodes[i + 1].node.type === "MemberExpression") {
|
||||||
|
currentGroup.push(printedNodes[i]);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
groups.push(currentGroup);
|
groups.push(currentGroup);
|
||||||
currentGroup = [];
|
currentGroup = [];
|
||||||
|
|
||||||
|
|
|
@ -166,3 +166,14 @@ method().then(x => x)[\"abc\"](x => x)[abc](x => x);
|
||||||
({}).a().b();
|
({}).a().b();
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`test this.js 1`] = `
|
||||||
|
"const sel = this.connections
|
||||||
|
.concat(this.activities.concat(this.operators))
|
||||||
|
.filter(x => x.selected);
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
const sel = this.connections
|
||||||
|
.concat(this.activities.concat(this.operators))
|
||||||
|
.filter(x => x.selected);
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
const sel = this.connections
|
||||||
|
.concat(this.activities.concat(this.operators))
|
||||||
|
.filter(x => x.selected);
|
Loading…
Reference in New Issue