From e62f90597277fba421042c6fd6e7d1be59b7da83 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 25 Aug 2017 18:55:49 -0700 Subject: Fixup: handle splice of multiple modifiers I changed the logic so that it might splice a new modifier into the existing linked list (not just at the end), but failed to account for the case where what we are splicing in isn't just a single modifier, but a whole *list* (which occurs when splicing in the shared modifiers themselves). This change handles that case with a bit of annoying linked-list cleverness. --- source/slang/parser.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp index c3969be42..e232880e9 100644 --- a/source/slang/parser.cpp +++ b/source/slang/parser.cpp @@ -572,7 +572,17 @@ namespace Slang // Splice the modifier into the linked list - modifier->next = *modifierLink; + // We need to deal with the case where the modifeir to + // be spliced in might actually be a modifier *list*, + // so that we actually want to splice in at the + // end of the new list... + auto spliceLink = &modifier->next; + while(*spliceLink) + spliceLink = &(*spliceLink)->next; + + // Do the splice. + *spliceLink = *modifierLink; + *modifierLink = modifier; modifierLink = &modifier->next; } -- cgit v1.2.3