summaryrefslogtreecommitdiffstats
path: root/source/slang/parser.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-08-25 18:55:49 -0700
committerTim Foley <tfoley@nvidia.com>2017-08-25 18:55:49 -0700
commite62f90597277fba421042c6fd6e7d1be59b7da83 (patch)
treef5a36e175cb5846b7aa5d41904b0e2bddb3c85c9 /source/slang/parser.cpp
parent8c68434d6fa6ff1b2e54586637869cceace9d1bb (diff)
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.
Diffstat (limited to 'source/slang/parser.cpp')
-rw-r--r--source/slang/parser.cpp12
1 files changed, 11 insertions, 1 deletions
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;
}