Reset "_last" for all but first enum elements.

There is an implicit assumption (see TypePass::enumvalueDeclaration()) that
only the first enum element has a non-null "_last" attribute, but this was
broken by the latest enum-related grammar changes as the second enum element
also had "_last" set, coming from the new "enumlist_tail" production. This
resulted in wrong values being used for the second (only) element.

Fix this by explicitly resetting "_last" of enumlist_tail to NULL when
building the semantic value associated with it.
This commit is contained in:
Vadim Zeitlin 2015-07-27 04:25:48 +02:00
commit 68492869fd

View file

@ -5944,6 +5944,7 @@ enumlist : enumlist_item optional_ignored_define_after_comma {
| enumlist_item enumlist_tail optional_ignored_define_after_comma {
set_nextSibling($1, $2);
Setattr($1,"_last",Getattr($2,"_last"));
Setattr($2,"_last",NULL);
$$ = $1;
}
| optional_ignored_define {