diff --git a/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/NameMapper.java b/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/NameMapper.java index 74ef17c65e89..7e9929d53ddb 100644 --- a/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/NameMapper.java +++ b/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/NameMapper.java @@ -13,7 +13,10 @@ import org.jetbrains.debugger.sourcemap.SourceMap; import java.util.Map; public final class NameMapper { - private static final CharMatcher NAME_TRIMMER = CharMatcher.INVISIBLE.or(CharMatcher.anyOf(".,()[]{}=")); + public static final String S1 = ",()[]{}="; + private static final CharMatcher NAME_TRIMMER = CharMatcher.INVISIBLE.or(CharMatcher.anyOf(S1 + ".&")); + // don't trim trailing .& - could be part of expression + private static final CharMatcher OPERATOR_TRIMMER = CharMatcher.INVISIBLE.or(CharMatcher.anyOf(S1)); private final Document document; private final Document generatedDocument; @@ -41,7 +44,7 @@ public final class NameMapper { MappingEntry sourceEntry = sourceMappings.get(line, offset - document.getLineStartOffset(line)); String sourceEntryName = sourceEntry == null ? null : sourceEntry.getName(); if (sourceEntry != null) { - String generatedName = trimName(getGeneratedName(generatedDocument, sourceMap, sourceEntry)); + String generatedName = trimName(getGeneratedName(generatedDocument, sourceMap, sourceEntry), true); if (!generatedName.isEmpty()) { String sourceName = sourceEntryName; if (sourceName == null) { @@ -60,8 +63,8 @@ public final class NameMapper { } @NotNull - public static String trimName(@NotNull CharSequence rawGeneratedName) { - String generatedName = NAME_TRIMMER.trimFrom(rawGeneratedName); + public static String trimName(@NotNull CharSequence rawGeneratedName, boolean isLastToken) { + String generatedName = (isLastToken ? NAME_TRIMMER : OPERATOR_TRIMMER).trimFrom(rawGeneratedName); // GWT - button_0_g$ = new Button_5_g$('Click me'); // so, we should remove all after "=" int i = generatedName.indexOf('=');