diff options
author | Thomas White <taw@physics.org> | 2021-03-29 17:35:56 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-03-31 21:56:36 +0200 |
commit | 0e1b9e265864deef794504147c16264f0bcdae24 (patch) | |
tree | c8841af5b877080f50466cb0c400763f4d457db6 | |
parent | c54f90fb9754569676bb018265bc3f99f81755ca (diff) |
add-state-to-state: Make sure that no-value does not leak through
-rw-r--r-- | guile/starlet/base.scm | 31 |
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) |