@NotNull private static Set<LocalFunctionDeclarationInstruction> getLocalDeclarations( @NotNull Pseudocode pseudocode) { Set<LocalFunctionDeclarationInstruction> localDeclarations = Sets.newLinkedHashSet(); for (Instruction instruction : ((PseudocodeImpl) pseudocode).mutableInstructionList) { if (instruction instanceof LocalFunctionDeclarationInstruction) { localDeclarations.add((LocalFunctionDeclarationInstruction) instruction); localDeclarations.addAll( getLocalDeclarations(((LocalFunctionDeclarationInstruction) instruction).getBody())); } } return localDeclarations; }
@NotNull @Override public List<Instruction> getReversedInstructions() { LinkedHashSet<Instruction> traversedInstructions = Sets.newLinkedHashSet(); PseudocodeTraverserKt.traverseFollowingInstructions( sinkInstruction, traversedInstructions, BACKWARD, null); if (traversedInstructions.size() < instructions.size()) { List<Instruction> simplyReversedInstructions = Lists.newArrayList(instructions); Collections.reverse(simplyReversedInstructions); for (Instruction instruction : simplyReversedInstructions) { if (!traversedInstructions.contains(instruction)) { PseudocodeTraverserKt.traverseFollowingInstructions( instruction, traversedInstructions, BACKWARD, null); } } } return Lists.newArrayList(traversedInstructions); }