aboutsummaryrefslogtreecommitdiff
path: root/guile
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-03-29 17:35:56 +0200
committerThomas White <taw@physics.org>2021-03-31 21:56:36 +0200
commit0e1b9e265864deef794504147c16264f0bcdae24 (patch)
treec8841af5b877080f50466cb0c400763f4d457db6 /guile
parentc54f90fb9754569676bb018265bc3f99f81755ca (diff)
add-state-to-state: Make sure that no-value does not leak through
Diffstat (limited to 'guile')
-rw-r--r--guile/starlet/base.scm31
1 files changed, 17 insertions, 14 deletions
diff --git a/guile/starlet/base.scm b/guile/starlet/base.scm
index 3d052c1..41856ff 100644
--- a/guile/starlet/base.scm
+++ b/guile/starlet/base.scm
@@ -280,20 +280,23 @@
;; Add the contents of state "new" to "combined-state"
(define (add-state-to-state! merge-rule new combined-state)
- (state-for-each (lambda (fix attr value)
- (let ((current-value (state-find fix
- attr
- combined-state)))
- (if (eq? 'no-value current-value)
- (set-in-state! combined-state
- fix
- attr
- value)
- (set-in-state! combined-state
- fix
- attr
- (merge-rule attr current-value value)))))
- new))
+ (state-for-each (lambda (fix attr incoming-value)
+ (unless (eq? 'no-value incoming-value)
+ (let ((current-value (state-find fix
+ attr
+ combined-state)))
+ (if (eq? 'no-value current-value)
+ (set-in-state! combined-state
+ fix
+ attr
+ incoming-value)
+ (set-in-state! combined-state
+ fix
+ attr
+ (merge-rule attr
+ current-value
+ incoming-value))))))
+ new))
(define (apply-state state)