use of org.jetbrains.kotlin.cfg.pseudocode.instructions.special.LocalFunctionDeclarationInstruction in project kotlin by JetBrains.
the class AbstractPseudocodeTest method addDeclaration.
private static void addDeclaration(SetMultimap<KtElement, Pseudocode> data, BindingContext bindingContext, KtDeclaration declaration) {
Pseudocode pseudocode = PseudocodeUtil.generatePseudocode(declaration, bindingContext);
data.put(declaration, pseudocode);
for (LocalFunctionDeclarationInstruction instruction : pseudocode.getLocalDeclarations()) {
Pseudocode localPseudocode = instruction.getBody();
data.put(localPseudocode.getCorrespondingElement(), localPseudocode);
}
}
use of org.jetbrains.kotlin.cfg.pseudocode.instructions.special.LocalFunctionDeclarationInstruction in project kotlin by JetBrains.
the class CFGraphToDotFilePrinter method dumpNodes.
private static void dumpNodes(List<Instruction> instructions, PrintStream out, int[] count, Map<Instruction, String> nodeToName, Set<Instruction> remainedAfterPostProcessInstructions) {
for (Instruction node : instructions) {
String name = "n" + count[0]++;
nodeToName.put(node, name);
String text = node.toString();
int newline = text.indexOf("\n");
if (newline >= 0) {
text = text.substring(0, newline);
}
String shape = "box";
if (node instanceof ConditionalJumpInstruction || node instanceof UnconditionalJumpInstruction) {
shape = "diamond";
} else if (node instanceof NondeterministicJumpInstruction) {
shape = "Mdiamond";
} else if (node instanceof MagicInstruction && ((MagicInstruction) node).getKind() == MagicKind.UNSUPPORTED_ELEMENT) {
shape = "box, fillcolor=red, style=filled";
} else if (node instanceof LocalFunctionDeclarationInstruction) {
shape = "Mcircle";
} else if (node instanceof SubroutineEnterInstruction || node instanceof SubroutineExitInstruction) {
shape = "roundrect, style=rounded";
}
if (!remainedAfterPostProcessInstructions.contains(node)) {
shape += "box, fillcolor=grey, style=filled";
}
out.println(name + "[label=\"" + text + "\", shape=" + shape + "];");
}
}
Aggregations