| 2336 | }) |
| 2337 | } |
| 2338 | private _rebuild( |
| 2339 | recur: (ast: AST) => AST, |
| 2340 | recurParameter: (ast: AST) => AST, |
| 2341 | checks: Checks | undefined, |
| 2342 | encodingChecks: Checks | undefined |
| 2343 | ): Objects { |
| 2344 | const props = mapOrSame(this.propertySignatures, (ps) => { |
| 2345 | const t = recur(ps.type) |
| 2346 | return t === ps.type ? ps : new PropertySignature(ps.name, t) |
| 2347 | }) |
| 2348 | |
| 2349 | const indexes = mapOrSame(this.indexSignatures, (is) => { |
| 2350 | const p = recurParameter(is.parameter) |
| 2351 | const t = recur(is.type) |
| 2352 | return p === is.parameter && t === is.type |
| 2353 | ? is |
| 2354 | : new IndexSignature(p, t) |
| 2355 | }) |
| 2356 | |
| 2357 | return props === this.propertySignatures && indexes === this.indexSignatures && checks === this.checks && |
| 2358 | encodingChecks === this.encodingChecks |
| 2359 | ? this |
| 2360 | : new Objects( |
| 2361 | props, |
| 2362 | indexes, |
| 2363 | this.annotations, |
| 2364 | checks, |
| 2365 | undefined, |
| 2366 | this.context, |
| 2367 | encodingChecks |
| 2368 | ) |
| 2369 | } |
| 2370 | /** @internal */ |
| 2371 | flip(recur: (ast: AST) => AST): AST { |
| 2372 | return this._rebuild(recur, recur, this.encodingChecks, this.checks) |