Skip to content

Commit

Permalink
missing getNode cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Janther committed Dec 21, 2023
1 parent e75b618 commit 59a3d61
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/binary-operator-printers/arithmetic.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { doc } from 'prettier';
import { comparison } from './comparison.js';
import { getNode } from '../common/backward-compatibility.js';

const { group, line, indent } = doc.builders;

Expand All @@ -15,7 +16,7 @@ const groupIfNecessaryBuilder = (path) => (document) => {
};

const indentIfNecessaryBuilder = (path) => (document) => {
let node = path.getNode();
let node = getNode(path);
for (let i = 0; ; i += 1) {
const parentNode = path.getParentNode(i);
if (parentNode.type === 'ReturnStatement') return document;
Expand Down
3 changes: 2 additions & 1 deletion src/binary-operator-printers/comparison.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { doc } from 'prettier';
import { getNode } from '../common/backward-compatibility.js';

const { group, indent, line } = doc.builders;

const indentIfNecessaryBuilder = (path) => (document) => {
let node = path.getNode();
let node = getNode(path);
for (let i = 0; ; i += 1) {
const parentNode = path.getParentNode(i);
if (parentNode.type === 'ReturnStatement') return document;
Expand Down
3 changes: 2 additions & 1 deletion src/binary-operator-printers/logical.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { doc } from 'prettier';
import { getNode } from '../common/backward-compatibility.js';

const { group, line, indent } = doc.builders;

const groupIfNecessaryBuilder = (path) => (document) =>
path.getParentNode().type === 'BinaryOperation' ? document : group(document);

const indentIfNecessaryBuilder = (path, options) => (document) => {
let node = path.getNode();
let node = getNode(path);
for (let i = 0; ; i += 1) {
const parentNode = path.getParentNode(i);
if (parentNode.type === 'ReturnStatement') return document;
Expand Down

0 comments on commit 59a3d61

Please sign in to comment.