fork of hey-api/openapi-ts because I need some additional things
1import type { AnalysisContext } from '@hey-api/codegen-core';
2
3import { py } from '../../ts-python';
4import { PyDsl } from '../base';
5import type { DoExpr } from '../mixins/do';
6import { DoMixin } from '../mixins/do';
7import { LayoutMixin } from '../mixins/layout';
8
9const Mixed = DoMixin(LayoutMixin(PyDsl<py.Block>));
10
11export class BlockPyDsl extends Mixed {
12 readonly '~dsl' = 'BlockPyDsl';
13
14 constructor(...items: Array<DoExpr>) {
15 super();
16 this.do(...items);
17 }
18
19 override analyze(ctx: AnalysisContext) {
20 super.analyze(ctx);
21 }
22
23 override toAst() {
24 const statements = this.$do();
25 return py.factory.createBlock(statements);
26 }
27}