mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Well-known lambdas cannot be called from runtime
This commit is contained in:
parent
7a8c4e45f6
commit
0a9cd2a6b7
1 changed files with 15 additions and 2 deletions
|
@ -2029,6 +2029,15 @@
|
|||
(hash-table-delete! scopes param-sym)
|
||||
)
|
||||
|
||||
;; Determine if the expression is a call to a primitive that receives
|
||||
;; a continuation. This is important since well-known functions cannot
|
||||
;; be passed as such a cont.
|
||||
(define (prim-call/cont? exp)
|
||||
(let ((result (and (app? exp)
|
||||
(prim:cont? (car exp)))))
|
||||
(trace:info `(prim-call/cont? ,exp ,result))
|
||||
result))
|
||||
|
||||
(define (found exp . sym)
|
||||
(let ((lid (ast:lambda-id exp)))
|
||||
(if (null? sym)
|
||||
|
@ -2062,11 +2071,15 @@
|
|||
((app? exp)
|
||||
(cond
|
||||
((ast:lambda? (car exp))
|
||||
(found (car exp)) ;; We immediately know these lambdas are well-known
|
||||
(when (not (any prim-call/cont? (cdr exp)))
|
||||
(found (car exp))) ;; We immediately know these lambdas are well-known
|
||||
(let ((formals (ast:lambda-formals->list (car exp))))
|
||||
(when (and (pair? formals)
|
||||
(pair? (cdr exp))
|
||||
(ast:lambda? (cadr exp)))
|
||||
(ast:lambda? (cadr exp))
|
||||
;; Lambda is not well-known when called from a runtime prim
|
||||
;;(not (any prim-call/cont? (cdr exp)))
|
||||
)
|
||||
(add-candidate! (cadr exp) (car exp) (car formals)))
|
||||
)
|
||||
;; Scan the rest of the args
|
||||
|
|
Loading…
Add table
Reference in a new issue