import type { PyNodeBase } from '../base'; import type { PyExpression } from '../expression'; import { PyNodeKind } from '../kinds'; import type { PyStatement } from '../statement'; import { createBlock, type PyBlock } from './block'; import type { PyWithItem } from './withItem'; export interface PyWithStatement extends PyNodeBase { body: PyBlock; items: ReadonlyArray; kind: PyNodeKind.WithStatement; modifiers?: ReadonlyArray; } export function createWithStatement( items: ReadonlyArray, body: ReadonlyArray, modifiers?: ReadonlyArray, leadingComments?: ReadonlyArray, trailingComments?: ReadonlyArray, ): PyWithStatement { return { body: createBlock(body), items, kind: PyNodeKind.WithStatement, leadingComments, modifiers, trailingComments, }; }