gbf_core::decompiler::function_decompiler

Struct FunctionDecompiler

Source
pub struct FunctionDecompiler { /* private fields */ }
Expand description

A struct to hold the state of a function decompiler

Implementations§

Source§

impl FunctionDecompiler

Source

pub fn new(function: Function) -> Self

A new method for the FunctionDecompiler struct.

§Arguments
  • function: The function to analyze and decompile.
§Returns
  • A newly constructed FunctionDecompiler instance.
§Errors
  • FunctionDecompilerError if there is an error while decompiling the function.
Source§

impl FunctionDecompiler

Source

pub fn decompile( &mut self, emit_context: EmitContext, ) -> Result<String, FunctionDecompilerError>

Decompile the function and emit the AST as a string.

§Arguments
  • context: The context for AST emission.
§Returns
  • The emitted AST as a string.
§Errors
  • Returns FunctionDecompilerError for any issues encountered during decompilation.
Source

pub fn add_node_to_current_region(&mut self, node: AstKind)

Add a node to the current region.

Trait Implementations§

Source§

impl DotRenderableGraph for FunctionDecompiler

Source§

fn render_dot(&self, config: CfgDotConfig) -> String

Convert the Graph to dot format.

§Returns
  • A String containing the dot representation of the graph.
Source§

impl NodeResolver for FunctionDecompiler

Source§

type NodeData = Region

The renderable node type associated with the resolver.
Source§

fn resolve(&self, node_index: NodeIndex) -> Option<&Self::NodeData>

Resolves a NodeIndex to its associated metadata.
Source§

fn resolve_edge_color(&self, _: NodeIndex, _: NodeIndex) -> String

Resolves the color of the edge between two nodes.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.