]> git.donarmstrong.com Git - lilypond.git/commitdiff
Do more thorough typechecking in ly:make-music-function
authorDavid Kastrup <dak@gnu.org>
Tue, 6 Dec 2011 17:04:31 +0000 (18:04 +0100)
committerDavid Kastrup <dak@gnu.org>
Tue, 6 Dec 2011 17:04:31 +0000 (18:04 +0100)
lily/music-function-scheme.cc

index 8470a97005e4d57db4c57203ee108459b217bc26..e87872caaca3bb6802c36ba2fd33aead726ddf55 100644 (file)
@@ -24,7 +24,21 @@ LY_DEFINE (ly_make_music_function, "ly:make-music-function", 2, 0, 0,
            " containing either @code{ly:music?} predicates or other type"
            " predicates.  Its car is the syntax function to call.")
 {
-  LY_ASSERT_TYPE (ly_is_procedure, func, 1);
+  LY_ASSERT_TYPE (ly_is_list, signature, 1);
+  LY_ASSERT_TYPE (ly_is_procedure, func, 2);
+  int n=0;
+  for (SCM p = signature; scm_is_pair (p); p = scm_cdr (p), ++n)
+    {
+      SCM proc = scm_car (p);
+      if (scm_is_pair (proc))
+       proc = scm_car (proc);
+      if (scm_is_false (scm_procedure_p (proc)))
+       {
+         scm_wrong_type_arg_msg ("music-function", n, p,
+                                 "music function predicate");
+       }
+    }
+
   return make_music_function (signature, func);
 }