Skip to content

Commit 1d19c2d

Browse files
committed
feat: add support for CodeBlocks with argv
Signed-off-by: Nick Mitchell <[email protected]>
1 parent 41f6429 commit 1d19c2d

File tree

8 files changed

+1132
-172
lines changed

8 files changed

+1132
-172
lines changed

pdl-live-react/src/pdl_ast.d.ts

Lines changed: 396 additions & 152 deletions
Large diffs are not rendered by default.

pdl-live-react/src/pdl_ast_utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function map_block_children(
5151
}
5252
})
5353
.with({ kind: "code" }, (block) => {
54-
const code = f(block.code)
54+
const code = Array.isArray(block.code) ? block.code.map(f) : f(block.code)
5555
return { ...block, code: code }
5656
})
5757
.with({ kind: "get" }, (block) => block)
@@ -155,7 +155,11 @@ export function iter_block_children(
155155
if (block.input) f(block.input)
156156
})
157157
.with({ kind: "code" }, (block) => {
158-
f(block.code)
158+
if (Array.isArray(block.code)) {
159+
block.code.forEach(f)
160+
} else {
161+
f(block.code)
162+
}
159163
})
160164
.with({ kind: "get" }, () => {})
161165
.with({ kind: "data" }, () => {})

0 commit comments

Comments
 (0)