This commit is contained in:
Justin Ethier 2016-05-20 22:43:00 -04:00
parent 5f002237cd
commit 397b10dc4d

View file

@ -17,8 +17,8 @@
; can write initial analyze, but can't get too far without being able ; can write initial analyze, but can't get too far without being able
; to uniquely ID each lambda ; to uniquely ID each lambda
(define-library (cps-optimizations) ;(define-library (cps-optimizations)
;(define-library (scheme cyclone cps-optimizations) (define-library (scheme cyclone cps-optimizations)
(import (scheme base) (import (scheme base)
(scheme cyclone util) (scheme cyclone util)
(scheme cyclone ast) (scheme cyclone ast)
@ -166,7 +166,8 @@
;; ;;
;; obviously need to add code later on to reset const if mutated ;; obviously need to add code later on to reset const if mutated
(cond (cond
((ast:lambda? (car exp)) ((and (ast:lambda? (car exp))
(list? (ast:lambda-args (car exp)))) ;; For now, avoid complications with optional/extra args
(let ((params (ast:lambda-args (car exp)))) (let ((params (ast:lambda-args (car exp))))
(for-each (for-each
(lambda (arg) (lambda (arg)
@ -318,6 +319,7 @@
((app? exp) ((app? exp)
(cond (cond
((and (ast:lambda? (car exp)) ((and (ast:lambda? (car exp))
(list? (ast:lambda-args (car exp))) ;; Avoid optional/extra args
(= (length (ast:lambda-args (car exp))) (= (length (ast:lambda-args (car exp)))
(length (app->args exp)))) (length (app->args exp))))
(let ((new-params '()) (let ((new-params '())