public List<GuardExpression> findElseConnectableGuards() { if (!getTypeGuards().isEmpty()) { return Collections.emptyList(); } if (getGuards().isEmpty()) { return Collections.emptyList(); } List<GuardExpression> elseConnectableGuards = new ArrayList<>(); int guardIndex = 0; while (guardIndex < getGuards().size() && findNegatedGuardInPrevious(getGuards().get(guardIndex)) != null) { elseConnectableGuards.add(getGuards().get(guardIndex)); guardIndex++; } return elseConnectableGuards; }
private List<GuardExpression> findElseConnectableGuards() { if (!getTypeGuards().isEmpty()) { return Collections.emptyList(); } if (getGuards().isEmpty()) { return Collections.emptyList(); } List<GuardExpression> elseConnectableGuards = new ArrayList<>(); int guardIndex = 0; while (guardIndex < getGuards().size() && findNegatedGuardInPrevious(getGuards().get(guardIndex)) != null) { elseConnectableGuards.add(getGuards().get(guardIndex)); guardIndex++; } return elseConnectableGuards; }
private static boolean isReachableGroup(SpecializationGroup group, int ifCount) { if (ifCount != 0) { return true; } SpecializationGroup previous = group.getPreviousGroup(); if (previous == null || previous.findElseConnectableGuards().isEmpty()) { return true; } /* * Hacky else case. In this case the specialization is not reachable due to previous else * branch. This is only true if the minimum state is not checked. */ if (previous.getGuards().size() == 1 && previous.getTypeGuards().isEmpty() && (previous.getParent() == null || previous.getMaxSpecializationIndex() != previous.getParent().getMaxSpecializationIndex())) { return false; } return true; }
private boolean hasFallthrough(SpecializationGroup group, TypeMirror forType, LocalContext currentValues, boolean fastPath, List<GuardExpression> ignoreGuards) { for (TypeGuard guard : group.getTypeGuards()) { if (currentValues.getValue(guard.getSignatureIndex()) == null) {
for (TypeGuard castGuard : group.getTypeGuards()) { if (isTypeGuardUsedInAnyGuardOrCacheBelow(group, currentValues, castGuard, execution.isFastPath())) { castGuards.add(castGuard); CodeTree[] checkAndCast = createTypeCheckAndLocals(specialization, group.getTypeGuards(), castGuards, currentValues, execution);
for (NodeExecutionData execution : node.getChildExecutions()) { boolean canExecuteChild = execution.getIndex() < currentType.getEvaluatedCount(); for (TypeGuard checkedGuard : originalGroup.getTypeGuards()) { if (checkedGuard.getSignatureIndex() == execution.getIndex()) { canExecuteChild = true; break; for (TypeGuard checkedGuard : originalGroup.getTypeGuards()) {
boolean hasImplicitCast = false; List<IfTriple> cachedTriples = new ArrayList<>(); for (TypeGuard guard : group.getTypeGuards()) { IfTriple triple = createTypeCheckOrCast(frameState, group, guard, mode, false, true); if (triple != null) {
for (TypeGuard checkedGuard : group.getTypeGuards()) { if (!ElementUtils.isPrimitive(checkedGuard.getType())) { group.getTypeGuards().remove(eliminatedGuard); targetType = eliminatedGuard.getType(); } else {