Permalink
Browse files

Fix infinite replacement loop when macro parameters have the value as…

… the parameter name. Fixes #109
  • Loading branch information...
Kingcom committed Mar 10, 2018
1 parent f35f08c commit 5157a4268f229551c8ee0ef919f863973472ade1
Showing with 4 additions and 1 deletion.
  1. +4 −1 Parser/Tokenizer.cpp
@@ -42,7 +42,10 @@ bool Tokenizer::processElement(TokenList::iterator& it)
(*it) = replacement.value[0];
tokens.insert(insertIt,replacement.value.begin()+1, replacement.value.end());

replaced = true;
// If the value at this position didn't change, then just keep going.
// Otherwise we'd be stuck in an endless replace loop
if (stringValue != (*it).getStringValue())
replaced = true;
break;
}
}

0 comments on commit 5157a42

Please sign in to comment.