mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Also identify pure functions using assigned-var
This identifies cases where a pure function exits but is defined inline rather than at the top-level.
This commit is contained in:
parent
b74213ec2d
commit
c7aa3700ea
1 changed files with 12 additions and 5 deletions
|
@ -1075,11 +1075,18 @@
|
|||
;; Does ref refer to a pure function (no side effects)?
|
||||
(let ((var (adb:get/default (car exp) #f)))
|
||||
(if var
|
||||
(let ((lid (adbv:defines-lambda-id var)))
|
||||
(if lid
|
||||
(with-fnc! lid (lambda (fnc)
|
||||
(if (not (adbf:side-effects fnc))
|
||||
(set! pure-fnc #t))))))))
|
||||
(let ((lid (adbv:defines-lambda-id var))
|
||||
(assigned-val (adbv:assigned-value var)))
|
||||
(cond
|
||||
(lid
|
||||
(with-fnc! lid (lambda (fnc)
|
||||
(if (not (adbf:side-effects fnc))
|
||||
(set! pure-fnc #t)))))
|
||||
((ast:lambda? assigned-val)
|
||||
(with-fnc! (ast:lambda-id assigned-val) (lambda (fnc)
|
||||
(if (not (adbf:side-effects fnc))
|
||||
(set! pure-fnc #t)))))
|
||||
))))
|
||||
;;
|
||||
(with-var (car exp) (lambda (var)
|
||||
(let ((val (adbv:assigned-value var)))
|
||||
|
|
Loading…
Add table
Reference in a new issue