Skip to content

Commit 0ed5a67

Browse files
committed
using existing helper
1 parent 569ec59 commit 0ed5a67

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/slang-nodes/IndexAccessExpression.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { doc } from 'prettier';
22
import { NonterminalKind } from '@nomicfoundation/slang/cst';
3+
import { printSeparatedItem } from '../slang-printers/print-separated-item.js';
34
import { isLabel } from '../slang-utils/is-label.js';
45
import { getNodeMetadata, updateMetadata } from '../slang-utils/metadata.js';
56
import { Expression } from './Expression.js';
@@ -10,7 +11,7 @@ import type { AstPath, Doc, ParserOptions } from 'prettier';
1011
import type { AstNode } from './types.d.ts';
1112
import type { PrintFunction, SlangNode } from '../types.d.ts';
1213

13-
const { group, indent, indentIfBreak, label, softline } = doc.builders;
14+
const { group, indentIfBreak, label } = doc.builders;
1415

1516
export class IndexAccessExpression implements SlangNode {
1617
readonly kind = NonterminalKind.IndexAccessExpression;
@@ -43,13 +44,12 @@ export class IndexAccessExpression implements SlangNode {
4344
}
4445

4546
print(path: AstPath<IndexAccessExpression>, print: PrintFunction): Doc {
46-
const operandDoc: Doc = path.call(print, 'operand');
47-
const indexDoc: Doc = group([
47+
const operandDoc = path.call(print, 'operand');
48+
const indexDoc = [
4849
'[',
49-
indent([softline, path.call(print, 'start'), path.call(print, 'end')]),
50-
softline,
50+
printSeparatedItem([path.call(print, 'start'), path.call(print, 'end')]),
5151
']'
52-
]);
52+
];
5353

5454
// If we are at the end of a MemberAccessChain we should indent the
5555
// arguments accordingly.

0 commit comments

Comments
 (0)