Skip to content

Commit d02ac86

Browse files
committed
more cleanups... I cant stop
1 parent 3e8935f commit d02ac86

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

src/core/batch.rkt

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -206,36 +206,30 @@
206206
[(? number?) (if (representation? type) (literal enode (representation-name type)) enode)]
207207
[(? symbol?)
208208
(if (hash-has-key? rename-dict enode) (car (hash-ref rename-dict enode)) enode)]
209-
[(list '$approx spec impl)
209+
[(list '$approx spec (app eggref impl))
210210
(define spec* (vector-ref id->spec spec))
211211
(unless spec*
212212
(error 'regraph-extract-variants "no initial approx node in eclass"))
213213
(define spec-type (if (representation? type) (representation-type type) type))
214214
(define final-spec (egg-parsed->expr spec* rename-dict spec-type))
215215
(define final-spec-idx (mutable-batch-munge! out final-spec))
216-
(approx final-spec-idx (loop (eggref impl) type))]
217-
[(list 'if cond ift iff)
216+
(approx final-spec-idx (loop impl type))]
217+
[(list 'if (app eggref cond) (app eggref ift) (app eggref iff))
218218
(if (representation? type)
219-
(list 'if
220-
(loop (eggref cond) (get-representation 'bool))
221-
(loop (eggref ift) type)
222-
(loop (eggref iff) type))
223-
(list 'if
224-
(loop (eggref cond) 'bool)
225-
(loop (eggref ift) type)
226-
(loop (eggref iff) type)))]
227-
[(list (? impl-exists? impl) ids ...)
228-
(define args
229-
(for/list ([id (in-list ids)]
219+
(list 'if (loop cond (get-representation 'bool)) (loop ift type) (loop iff type))
220+
(list 'if (loop cond 'bool) (loop ift type) (loop iff type)))]
221+
[(list (? impl-exists? impl) (app eggref args) ...)
222+
(define args*
223+
(for/list ([arg (in-list args)]
230224
[type (in-list (impl-info impl 'itype))])
231-
(loop (eggref id) type)))
232-
(cons impl args)]
233-
[(list (? operator-exists? op) ids ...)
234-
(define args
235-
(for/list ([id (in-list ids)]
225+
(loop arg type)))
226+
(cons impl args*)]
227+
[(list (? operator-exists? op) (app eggref args) ...)
228+
(define args*
229+
(for/list ([arg (in-list args)]
236230
[type (in-list (operator-info op 'itype))])
237-
(loop (eggref id) type)))
238-
(cons op args)]))
231+
(loop arg type)))
232+
(cons op args*)]))
239233
(batch-push! out enode*)))
240234
(batchref input-batch idx))
241235

0 commit comments

Comments
 (0)