From ceb2e7b4fa3b6d9c39565e8ab86a2b143031f686 Mon Sep 17 00:00:00 2001 From: AwesomeAdam54321 Date: Thu, 17 Sep 2026 03:51:53 +0800 Subject: [PATCH] vala: valac: Fix midrule type declarations for parser. --- vala/valac/parser.y | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/vala/valac/parser.y b/vala/valac/parser.y index abdfda340..d92b91e5b 100644 --- a/vala/valac/parser.y +++ b/vala/valac/parser.y @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -116,8 +117,8 @@ ValaLocation *get_location (int lineno, int colno) %defines %locations -%error-verbose -%pure_parser +%define parse.error verbose +%define api.pure %glr-parser %union { int num; @@ -1591,21 +1592,21 @@ struct_or_array_initializer struct_declaration : opt_attribute_sections STRUCT IDENTIFIER opt_type_parameter_list { - $$ = g_new0 (ValaStruct, 1); - $$->name = g_strdup ($3); - $$->location = current_location (@2); - $$->type_parameters = $4; - $$->namespace = current_namespace; - $$->cname = g_strdup_printf ("%s%s", current_namespace->cprefix, $$->name); - $$->lower_case_cname = camel_case_to_lower_case ($$->name); - $$->upper_case_cname = camel_case_to_upper_case ($$->name); - current_namespace->structs = g_list_append (current_namespace->structs, $$); - current_struct = $$; - - $$->annotations = $1; + $$ = g_new0 (ValaStruct, 1); + $$->name = g_strdup ($3); + $$->location = current_location (@2); + $$->type_parameters = $4; + $$->namespace = current_namespace; + $$->cname = g_strdup_printf ("%s%s", current_namespace->cprefix, $$->name); + $$->lower_case_cname = camel_case_to_lower_case ($$->name); + $$->upper_case_cname = camel_case_to_upper_case ($$->name); + current_namespace->structs = g_list_append (current_namespace->structs, $$); + current_struct = $$; + + $$->annotations = $1; GList *l, *al; - for (l = $$->annotations; l != NULL; l = l->next) { + for (l = $$->annotations; l != NULL; l = l->next) { ValaAnnotation *anno = l->data; if (strcmp (anno->type->type_name, "CCode") == 0) { @@ -1613,11 +1614,11 @@ struct_declaration ValaNamedArgument *arg = al->data; if (strcmp (arg->name, "cname") == 0) { - $$->cname = eval_string (arg->expression->str); + $$->cname = eval_string (arg->expression->str); } } } else if (strcmp (anno->type->type_name, "ReferenceType") == 0) { - $$->reference_type = TRUE; + $$->reference_type = TRUE; } } } -- 2.54.0