You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicbooleanadd(
ATNConfigconfig,
DoubleKeyMap<PredictionContext,PredictionContext,PredictionContext> mergeCache)
{
if ( readonly ) thrownewIllegalStateException("This set is readonly");
if ( config.semanticContext!=SemanticContext.NONE ) {
hasSemanticContext = true;
}
if (config.getOuterContextDepth() > 0) {
dipsIntoOuterContext = true;
}
ATNConfigexisting = configLookup.getOrAdd(config);
if ( existing==config ) { // we added this new onecachedHashCode = -1;
configs.add(config); // track order herereturntrue;
}
// a previous (s,i,pi,_), merge with it and save resultbooleanrootIsWildcard = !fullCtx;
PredictionContextmerged =
PredictionContext.merge(existing.context, config.context, rootIsWildcard, mergeCache);
// no need to check for existing.context, config.context in cache// since only way to create new graphs is "call rule" and here. We// cache at both places.existing.reachesIntoOuterContext =
Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
// make sure to preserve the precedence filter suppression during the mergeif (config.isPrecedenceFilterSuppressed()) {
existing.setPrecedenceFilterSuppressed(true);
}
// here !!existing.context = merged; // replace context; no need to alt mappingreturntrue;
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The field used to calculate the HashCode is changed after the Hash container is registered.
antlr4/runtime/Java/src/org/antlr/v4/runtime/atn/ATNConfigSet.java
Line 146 in fcab02c
Beta Was this translation helpful? Give feedback.
All reactions