mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
partially pass "quick evaluate Uglified Coffee" spec
This commit is contained in:
+7
-4
@@ -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('=');
|
||||
|
||||
Reference in New Issue
Block a user