mirror of
https://github.com/DMaroo/GhidRust.git
synced 2025-12-24 19:20:22 +01:00
26 lines
793 B
Java
26 lines
793 B
Java
package ghidrust.decompiler.codegen.rust;
|
|
|
|
import ghidra.app.decompiler.ClangNode;
|
|
import ghidra.app.decompiler.ClangBreak;
|
|
|
|
public class RustVisitor {
|
|
public String visit(ClangNode cn) {
|
|
/* This part is very ugly, but we don't have open classes
|
|
* do we can't define new virtual methods, hence the only
|
|
* way to dispatch is to check the node's type dynamically
|
|
*/
|
|
|
|
if (cn instanceof ClangBreak) {
|
|
return "break;";
|
|
} else {
|
|
/* Unimplemented */
|
|
StringBuilder sb = new StringBuilder("unimplemented {");
|
|
for (int i = 0; i < cn.numChildren(); i++) {
|
|
sb.append(visit(cn.Child(i)));
|
|
}
|
|
sb.append(" }");
|
|
return sb.toString();
|
|
}
|
|
}
|
|
}
|