changed token limit for tree rebuild

is necessary because otherwise the identity analysis might not be able
to detect if paths are identical up to the token limit (which should
cause an error)
This commit is contained in:
overflowerror 2022-01-07 20:44:36 +01:00
parent 8fac71dda9
commit edbc920247
2 changed files with 4 additions and 3 deletions

View file

@ -238,7 +238,7 @@ public class HoistingProcessor {
// all paths are trivial
// if there is a terminal on all branches set has terminal to true
// else we need might need to consider the following tokens in the path
// else we might need to consider the following tokens in the path
if (guards.stream().allMatch(HoistingGuard::hasTerminal)) {
return HoistingGuard.terminal();
} else {

View file

@ -500,7 +500,7 @@ public class TokenAnalysis {
tokenCombinations(indexList -> {
log.info("current index list: " + indexList);
// no context analysis
// no context analysis // TODO why?
List<List<Token>> tokenListsForPath = getTokenPaths(element, indexList, false);
List<List<Token>> tokenListForContext = getTokenPathsContextOnly(element, indexList);
@ -572,7 +572,8 @@ public class TokenAnalysis {
}
public List<List<AbstractElement>> getAllPossiblePaths(AbstractElement path) {
return getTokenPaths(path, new TokenAnalysisPaths(range(0, config.getTokenLimit() + 1)), false, false, true)
// token limit + 2 so identity analysis will recognize paths that are identical up to the token limit on the flattened tree
return getTokenPaths(path, new TokenAnalysisPaths(range(0, config.getTokenLimit() + 2)), false, false, true)
.getTokenPaths()
.stream()
.map(l -> l.stream()