precompute hashcode (IDEA-225101)

GitOrigin-RevId: 74d93b49bbfebab7eb375481d12062bad545ed9e
This commit is contained in:
Dennis Ushakov
2019-11-25 12:41:41 +00:00
committed by intellij-monorepo-bot
parent aeb7990cc0
commit 80f9ad7923
@@ -11,6 +11,7 @@ import org.jetbrains.plugins.textmate.regex.StringWithId;
import java.util.Objects;
class TextMateLexerState implements LexerState {
private final int hashcode;
@NotNull public final SyntaxNodeDescriptor syntaxRule;
@NotNull public final MatchData matchData;
@NotNull public final TextMateWeigh.Priority priorityMatch;
@@ -24,6 +25,7 @@ class TextMateLexerState implements LexerState {
this.matchData = matchData;
this.priorityMatch = priority;
string = matchData.matched() ? line : null;
hashcode = Objects.hash(syntaxRule, matchData, priorityMatch, stringId());
}
public static TextMateLexerState notMatched(@NotNull SyntaxNodeDescriptor syntaxRule) {
@@ -57,7 +59,7 @@ class TextMateLexerState implements LexerState {
@Override
public int hashCode() {
return Objects.hash(syntaxRule, matchData, priorityMatch, stringId());
return hashcode;
}
@Nullable