forked from jasder/antlr
Make return states the same size as the parent array.
Both arrays have always the same size and after reducing common parents in a prediction context optimization we also have to update the states array.
This commit is contained in:
parent
e1fb0b68c7
commit
218ae73608
|
@ -350,8 +350,10 @@ Ref<PredictionContext> PredictionContext::mergeArrays(const Ref<ArrayPredictionC
|
||||||
}
|
}
|
||||||
|
|
||||||
// ml: this part differs from Java code. We have to recreate the context as the parents array is copied on creation.
|
// ml: this part differs from Java code. We have to recreate the context as the parents array is copied on creation.
|
||||||
if (combineCommonParents(mergedParents))
|
if (combineCommonParents(mergedParents)) {
|
||||||
|
mergedReturnStates.resize(mergedParents.size());
|
||||||
M = std::make_shared<ArrayPredictionContext>(mergedParents, mergedReturnStates);
|
M = std::make_shared<ArrayPredictionContext>(mergedParents, mergedReturnStates);
|
||||||
|
}
|
||||||
|
|
||||||
if (mergeCache != nullptr) {
|
if (mergeCache != nullptr) {
|
||||||
mergeCache->put(a, b, M);
|
mergeCache->put(a, b, M);
|
||||||
|
|
Loading…
Reference in New Issue