Avoid constructing the mergeCache when it's not needed

This commit is contained in:
Sam Harwell 2013-04-22 16:12:20 -05:00
parent f5294204ae
commit 6c8a6178ee
1 changed files with 6 additions and 1 deletions

View File

@ -317,7 +317,7 @@ public class ParserATNSimulator extends ATNSimulator {
" exec LA(1)=="+ getLookaheadName(input)+
" line "+input.LT(1).getLine()+":"+input.LT(1).getCharPositionInLine());
}
mergeCache = new DoubleKeyMap<PredictionContext,PredictionContext,PredictionContext>();
_input = input;
_startIndex = input.index();
_outerContext = outerContext;
@ -775,6 +775,11 @@ public class ParserATNSimulator extends ATNSimulator {
boolean fullCtx)
{
if ( debug ) System.out.println("in computeReachSet, starting closure: " + closure);
if (mergeCache == null) {
mergeCache = new DoubleKeyMap<PredictionContext, PredictionContext, PredictionContext>();
}
ATNConfigSet intermediate = new ATNConfigSet(fullCtx);
/* Configurations already in a rule stop state indicate reaching the end