From 1ade706afe1a037f307b68e0536f21d70bc8e093 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Fri, 3 Nov 2017 10:19:00 +0100 Subject: [PATCH] SSR: the same variable can have multiple compiled names --- .../impl/matcher/compiler/PatternCompiler.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java index dfd9fc5e6618..418af01494a3 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java @@ -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(),