From 7bdc708e5f1532d2c8c42aba2a8839a6e2f6021c Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 2 Dec 2022 19:44:59 +0000 Subject: [PATCH] Template parameters handling tidy up Technical correction on how template parameters are stored in a Parm*. Doesn't actually make any change, but they are now displayed correctly when using debug options such as -debug-module. --- Source/CParse/parser.y | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index c0f1394d8..b3216bbc7 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -4485,8 +4485,7 @@ templateparameter : templcpptype def_args { Parm *p = $1; $$ = $1; - /* TODO: also slice off the name from the "type" */ - /* Rip out the parameter names */ + /* Correct the 'type name' parameter string, split into the appropriate "name" and "type" attributes */ String *name = Getattr(p, "name"); if (!name) { String *type = Getattr(p, "type"); @@ -4494,10 +4493,12 @@ templateparameter : templcpptype def_args { /* A 'class T' parameter */ const char *t = Strchr(type, ' '); Setattr(p, "name", t + 1); + Setattr(p, "type", NewStringWithSize(type, t - Char(type))); } else if ((Strncmp(type, "class... ", 9) == 0) || (Strncmp(type, "typename... ", 12) == 0)) { /* Variadic template args */ const char *t = Strchr(type, ' '); Setattr(p, "name", t + 1); + Setattr(p, "type", NewStringWithSize(type, t - Char(type))); Setattr(p, "variadic", "1"); } }