SSR: the same variable can have multiple compiled names

This commit is contained in:
Bas Leijdekkers
2017-11-03 10:21:44 +01:00
parent 087424e42f
commit 1ade706afe
@@ -361,11 +361,10 @@ public class PatternCompiler {
throw new MalformedPatternException();
}
buf.append(text.substring(prevOffset, offset));
buf.append(prefix);
buf.append(name);
final String compiledName = prefix + name;
buf.append(text.substring(prevOffset, offset)).append(compiledName);
if (seen.add(name)) {
if (seen.add(compiledName)) {
// the same variable can occur multiple times in a single template
// no need to process it more than once
@@ -379,7 +378,7 @@ public class PatternCompiler {
SubstitutionHandler handler = result.createSubstitutionHandler(
name,
prefix + name,
compiledName,
constraint.isPartOfSearchResults(),
constraint.getMinCount(),
constraint.getMaxCount(),