Skip to content

Commit

Permalink
refactor: Simplify lambda blocks to expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek and TeamModerne committed Aug 17, 2024
1 parent adec9d5 commit ec2d83c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,8 @@ public J.ForLoop.Control visitForControl(J.ForLoop.Control control, P p) {
// Point any `continue` nodes to the condition node
bodyAnalysis.continueFlow.forEach(continueControlFlowNode -> continueControlFlowNode.addSuccessor(entryBlock[0].getSuccessor()));
// Add the 'increment' statement to the basic block as the last element
controlAnalysisSecondBit.current.forEach(controlFlowNode -> {
controlFlowNode.addSuccessor(entryBlock[0].getSuccessor());
});
controlAnalysisSecondBit.current.forEach(controlFlowNode ->
controlFlowNode.addSuccessor(entryBlock[0].getSuccessor()));

current = Stream.concat(Stream.of(getControlFlowNodeMissingOneSuccessor(allAsConditionNodesMissingTruthFirst(controlAnalysisFirstBit.current))), bodyAnalysis.breakFlow.stream()).collect(Collectors.toSet());
return forLoop;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public J visitExpression(Expression expression, ExecutionContext e) {
public J visitVariable(J.VariableDeclarations.NamedVariable variable, ExecutionContext executionContext) {
DataFlowNode
.of(getCursor())
.forEach(n -> n.asParameter().forEach(p -> {
.forEach(n -> n.asParameter().forEach(p ->
p.getCallable().getMethodType().forEach(m -> {
FlowGraph g = ForwardFlow.findAllFlows(n, globalDataFlowSpec, flowGraphFactory);
parameterFlowGraphs.computeIfAbsent(m, __ -> flowGraphList(p.getCallable().getParameters().size()))
Expand All @@ -96,8 +96,7 @@ public J visitVariable(J.VariableDeclarations.NamedVariable variable, ExecutionC
sourceFlowGraphs.add(g);
}
walkFlowGraphConnecting(g);
});
}));
})));
return super.visitVariable(variable, executionContext);
}

Expand Down

0 comments on commit ec2d83c

Please sign in to comment.