diff options
Diffstat (limited to 'source/slang/parser.cpp')
| -rw-r--r-- | source/slang/parser.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp index 7ea3fe864..c3969be42 100644 --- a/source/slang/parser.cpp +++ b/source/slang/parser.cpp @@ -549,9 +549,30 @@ namespace Slang { RefPtr<Modifier>*& modifierLink = *ioModifierLink; - while(*modifierLink) + // We'd like to add the modifier to the end of the list, + // but we need to be careful, in case there is a "shared" + // section of modifiers for multiple declarations. + // + // TODO: This whole approach is a mess because we are "accidentally quadratic" + // when adding many modifiers. + for(;;) + { + // At end of the chain? Done. + if(!*modifierLink) + break; + + // About to look at shared modifiers? Done. + RefPtr<Modifier> linkMod = *modifierLink; + if(linkMod.As<SharedModifiers>()) + break; + + // Otherwise: keep traversing the modifier list. modifierLink = &(*modifierLink)->next; + } + + // Splice the modifier into the linked list + modifier->next = *modifierLink; *modifierLink = modifier; modifierLink = &modifier->next; } |
