From bed2b3b6de413b41cf33368614851884ac59c9a9 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Tue, 6 Dec 2011 18:04:31 +0100 Subject: [PATCH] Do more thorough typechecking in ly:make-music-function --- lily/music-function-scheme.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lily/music-function-scheme.cc b/lily/music-function-scheme.cc index 8470a97005..e87872caac 100644 --- a/lily/music-function-scheme.cc +++ b/lily/music-function-scheme.cc @@ -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); } -- 2.39.2