]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3247: Prohibit non-postevents returned by music functions to be used as post...
authorDavid Kastrup <dak@gnu.org>
Sat, 16 Mar 2013 10:22:27 +0000 (11:22 +0100)
committerDavid Kastrup <dak@gnu.org>
Thu, 21 Mar 2013 06:23:00 +0000 (07:23 +0100)
For example,

{ c-\mark \default }

produced an invalid music expression more or less indistinguishable from

{ \mark \default c }

Worse is that things like

{ c-\tweak color #red { g } }

also got accepted.  While \tweak (and other music functions) may
indeed return either post-events or straight music expressions, there
should be checks in place that the usage corresponds to its type.

lily/parser.yy

index 0197fe9d93e156a0a6a95feb163012f4bea7a0ad..79560ab1d7b52e346677809d0f54db18978dfdec 100644 (file)
@@ -2490,8 +2490,10 @@ post_events:
                $$ = SCM_EOL;
        }
        | post_events post_event {
-               unsmob_music ($2)->set_spot (@2);
-               $$ = scm_cons ($2, $$);
+               if (unsmob_music ($2)) {
+                       unsmob_music ($2)->set_spot (@2);
+                       $$ = scm_cons ($2, $$);
+               }
        }
        ;
 
@@ -2501,7 +2503,10 @@ post_event_nofinger:
        }
        | script_dir music_function_call_closed {
                $$ = $2;
-               if (!SCM_UNBNDP ($1))
+               if (!unsmob_music ($2)->is_mus_type ("post-event")) {
+                       parser->parser_error (@2, _ ("post-event expected"));
+                       $$ = SCM_UNSPECIFIED;
+               } else if (!SCM_UNBNDP ($1))
                {
                        unsmob_music ($$)->set_property ("direction", $1);
                }