| 691 | } |
| 692 | |
| 693 | function sameChecks(left: SchemaAST.Checks | undefined, right: SchemaAST.Checks | undefined): boolean { |
| 694 | if (left?.length !== right?.length) return false |
| 695 | if (left === undefined || right === undefined) return true |
| 696 | return left.every((check, index) => { |
| 697 | const other = right[index] |
| 698 | if (other === undefined || check._tag !== other._tag) return false |
| 699 | if (check._tag === "Filter" && other._tag === "Filter") { |
| 700 | return check.run === other.run && check.aborted === other.aborted |
| 701 | } |
| 702 | return check._tag === "FilterGroup" && other._tag === "FilterGroup" && sameChecks(check.checks, other.checks) |
| 703 | }) |
| 704 | } |
| 705 | |
| 706 | function sameContext(left: SchemaAST.Context | undefined, right: SchemaAST.Context | undefined) { |
| 707 | return left?.isOptional === right?.isOptional && left?.isMutable === right?.isMutable |