dist/ruby/nodes/aref.js in prettier-2.0.0 vs dist/ruby/nodes/aref.js in prettier-2.1.0
- old
+ new
@@ -17,13 +17,12 @@
// be the first child.
//
// foo[]
//
const printAref = (path, opts, print) => {
- const indexNode = path.getValue().body[1];
- if (!indexNode) {
- return [path.call(print, "body", 0), "[]"];
+ if (!path.getValue().index) {
+ return [path.call(print, "collection"), "[]"];
}
return (0, exports.printArefField)(path, opts, print);
};
exports.printAref = printAref;
// `aref_field` nodes are for assigning values into collections at specific
@@ -39,14 +38,13 @@
// So in the following example, `"foo"` is the array and `["bar"]` is the index.
//
// foo[bar] = baz
//
const printArefField = (path, opts, print) => {
- const [printedArray, printedIndex] = path.map(print, "body");
return group([
- printedArray,
+ path.call(print, "collection"),
"[",
- indent([softline, join([",", line], printedIndex)]),
+ indent([softline, join([",", line], path.call(print, "index"))]),
softline,
"]"
]);
};
exports.printArefField = printArefField;