Skip to content

Commit 1be6b97

Browse files
authored
Unify repeat and for loops and add while (#444)
1 parent 294e120 commit 1be6b97

File tree

19 files changed

+902
-2169
lines changed

19 files changed

+902
-2169
lines changed

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

Lines changed: 288 additions & 557 deletions
Large diffs are not rendered by default.

pdl-live-react/src/pdl_ast_utils.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@ export function map_block_children(
8787
})
8888
return { ...block, with: with_ }
8989
})
90-
.with({ kind: "repeat_until" }, (block) => {
91-
const repeat = f(block.repeat)
92-
return { ...block, repeat: repeat }
93-
})
94-
.with({ kind: "for" }, (block) => {
90+
.with({ kind: "repeat" }, (block) => {
9591
const repeat = f(block.repeat)
9692
return { ...block, repeat: repeat }
9793
})
@@ -181,10 +177,7 @@ export function iter_block_children(
181177
f(match_case.then)
182178
})
183179
})
184-
.with({ kind: "repeat_until" }, (block) => {
185-
f(block.repeat)
186-
})
187-
.with({ kind: "for" }, (block) => {
180+
.with({ kind: "repeat" }, (block) => {
188181
f(block.repeat)
189182
})
190183
.with({ kind: "error" }, (block) => f(block.program))

pdl-live-react/src/view/timeline/Timeline.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@
8989
&[data-kind="read"] {
9090
background-color: var(--pf-t--global--color--nonstatus--orange--default);
9191
}
92-
&[data-kind="repeat_until"],
9392
&[data-kind="repeat"],
94-
&[data-kind="for"],
9593
&[data-kind="lastOf"],
9694
&[data-kind="call"] {
9795
background-color: var(--pf-t--global--border--color--default);

pdl-live-react/src/view/timeline/model.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ export function childrenOf(block: NonScalarPdlBlock) {
102102
.with({ kind: "array" }, (data) => [data.array])
103103
.with({ kind: "object" }, (data) => [data.object])
104104
.with({ kind: "message" }, (data) => [data.content])
105-
.with({ kind: "repeat_until" }, (data) => [data.trace ?? data.repeat])
106-
.with({ kind: "for" }, (data) => [data.trace ?? data.repeat])
105+
.with({ kind: "repeat" }, (data) => [data.trace ?? data.repeat])
107106
.with({ kind: "empty" }, () => [])
108107
.with({ kind: "error" }, () => []) // TODO show errors in trace
109108
.with({ kind: undefined }, () => [])

0 commit comments

Comments
 (0)