mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-20 02:30:23 +02:00
peval: Recognize module-refs to primitives.
* module/language/tree-il/optimize.scm (peval): Handle module-refs to primitives. * test-suite/tests/tree-il.test ("partial evaluation"): Add test, using `pmatch'.
This commit is contained in:
parent
014de9e25d
commit
16d50b8e89
2 changed files with 22 additions and 0 deletions
|
@ -761,6 +761,19 @@
|
|||
(loop (cdr l) (+ sum (car l)))))
|
||||
(const 10))
|
||||
|
||||
(pass-if-peval
|
||||
;; Primitives in module-refs are resolved (the expansion of `pmatch'
|
||||
;; below leads to calls to (@@ (system base pmatch) car) and
|
||||
;; similar, which is what we want to be inlined.)
|
||||
(begin
|
||||
(use-modules (system base pmatch))
|
||||
(pmatch '(a b c d)
|
||||
((a b . _)
|
||||
#t)))
|
||||
(begin
|
||||
(apply . _)
|
||||
(const #t)))
|
||||
|
||||
(pass-if-peval
|
||||
;; Mutability preserved.
|
||||
((lambda (x y z) (list x y z)) 1 2 3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue