(
check: SchemaRepresentation.Check,
path: Path
)
| 294 | } |
| 295 | |
| 296 | function compileCheck( |
| 297 | check: SchemaRepresentation.Check, |
| 298 | path: Path |
| 299 | ): Fragment { |
| 300 | const callback = BuiltIns.resolveCheck(check, path) |
| 301 | let runtime: Fragment |
| 302 | if (callback !== undefined) { |
| 303 | const schemas = annotationSchemas(check.representation, [...path, "representation"]) |
| 304 | runtime = compileCallback( |
| 305 | schemas, |
| 306 | (schemas) => callback({ schemas }), |
| 307 | [...path, "annotations", "toCode"] |
| 308 | ).runtime |
| 309 | } else if (check._tag === "Filter") { |
| 310 | throw errorWithPath("Missing toCode callback", [...path, "annotations", "toCode"]) |
| 311 | } else { |
| 312 | runtime = code`${schemaImport}.makeFilterGroup([${ |
| 313 | join(check.checks.map((child, index) => compileCheck(child, [...path, "checks", index])), ", ") |
| 314 | }])` |
| 315 | } |
| 316 | runtime = code`${runtime}${runtimeAnnotate(check.annotations)}` |
| 317 | if (check._tag === "Filter" && check.aborted) runtime = code`${runtime}.abort()` |
| 318 | return runtime |
| 319 | } |
| 320 | |
| 321 | function applyNode( |
| 322 | base: Code, |
no test coverage detected