From 899cc9ee6763b5dfc3442c7473be7b88fe70ce34 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Mon, 8 Sep 2014 23:19:23 +0200 Subject: [PATCH] Derive melisma_busy state from child contexts when available --- lily/context.cc | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/lily/context.cc b/lily/context.cc index 8a85165cfd..da18102401 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -812,14 +812,29 @@ set_context_property_on_children (Context *trans, SCM sym, SCM val) bool melisma_busy (Context *tr) { - SCM melisma_properties = tr->get_property ("melismaBusyProperties"); - bool busy = false; + // When there are subcontexts, they are responsible for maintaining + // melismata. + SCM ch = tr->children_contexts (); + if (scm_is_pair (ch)) + { + // all contexts need to have a busy melisma for this to evaluate + // to true. + + do { + if (!melisma_busy (Context::unsmob (scm_car (ch)))) + return false; + ch = scm_cdr (ch); + } while (scm_is_pair (ch)); + return true; + } - for (; !busy && scm_is_pair (melisma_properties); + for (SCM melisma_properties = tr->get_property ("melismaBusyProperties"); + scm_is_pair (melisma_properties); melisma_properties = scm_cdr (melisma_properties)) - busy = busy || to_boolean (tr->get_property (scm_car (melisma_properties))); + if (to_boolean (tr->get_property (scm_car (melisma_properties)))) + return true; - return busy; + return false; } bool -- 2.39.5