mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-08 13:37:33 +02:00
Setup for tracking loop vars
This commit is contained in:
parent
e6c23e25c1
commit
b6732b988a
1 changed files with 14 additions and 0 deletions
|
@ -779,6 +779,12 @@ if (acc) {
|
||||||
(is-in? (cdr S)))))
|
(is-in? (cdr S)))))
|
||||||
(is-in? mutable-variables))
|
(is-in? mutable-variables))
|
||||||
|
|
||||||
|
(define mutated-loop-vars '())
|
||||||
|
(define (mark-mutated-loop-var sym)
|
||||||
|
(set! mutated-loop-vars (cons sym mutated-loop-vars)))
|
||||||
|
(define (mutated-loop-var? sym)
|
||||||
|
(member sym mutated-loop-var))
|
||||||
|
|
||||||
; analyze-mutable-variables : exp -> void
|
; analyze-mutable-variables : exp -> void
|
||||||
(define (analyze-mutable-variables exp)
|
(define (analyze-mutable-variables exp)
|
||||||
(cond
|
(cond
|
||||||
|
@ -803,6 +809,14 @@ if (acc) {
|
||||||
; Application:
|
; Application:
|
||||||
((app? exp)
|
((app? exp)
|
||||||
(map analyze-mutable-variables exp)
|
(map analyze-mutable-variables exp)
|
||||||
|
;; Check if the application is a sentinel indicating the
|
||||||
|
;; var may be used for a recursive loop.
|
||||||
|
;(when (and (= 2 (length exp))
|
||||||
|
; (ast:lambda? (car exp))
|
||||||
|
; (not (cadr exp)))
|
||||||
|
; ;; Candidate, see if the var is set to a lambda
|
||||||
|
; (with-var
|
||||||
|
;)
|
||||||
(void))
|
(void))
|
||||||
(else
|
(else
|
||||||
(error "unknown expression type: " exp))))
|
(error "unknown expression type: " exp))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue