From 68b00cdf45551ba64c4f7217963055fc5a1a0cc4 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Fri, 30 May 2025 16:39:32 -0400 Subject: [Rust] Express expression vs instruction index for MLIL and HLIL APIs This was done to fix unintended behavior using an instruction or expression index in place of the other. Fixes https://github.com/Vector35/binaryninja-api/issues/6897 --- rust/tests/language_representation.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'rust/tests/language_representation.rs') diff --git a/rust/tests/language_representation.rs b/rust/tests/language_representation.rs index c3d60966..f4aeb7bd 100644 --- a/rust/tests/language_representation.rs +++ b/rust/tests/language_representation.rs @@ -8,7 +8,7 @@ use binaryninja::disassembly::{ use binaryninja::function::Function; use binaryninja::headless::Session; use binaryninja::high_level_il::token_emitter::HighLevelILTokenEmitter; -use binaryninja::high_level_il::{HighLevelILFunction, HighLevelInstructionIndex}; +use binaryninja::high_level_il::{HighLevelExpressionIndex, HighLevelILFunction}; use binaryninja::language_representation::{ register_language_representation_function_type, CoreLanguageRepresentationFunction, CoreLanguageRepresentationFunctionType, LanguageRepresentationFunction, @@ -60,7 +60,7 @@ impl LanguageRepresentationFunction for MyLangRepr { fn expr_text( &self, il: &HighLevelILFunction, - expr_index: HighLevelInstructionIndex, + expr_index: HighLevelExpressionIndex, tokens: &HighLevelILTokenEmitter, _settings: &DisassemblySettings, _as_full_ast: bool, @@ -101,7 +101,7 @@ impl LanguageRepresentationFunction for MyLangRepr { fn begin_lines( &self, _il: &HighLevelILFunction, - _expr_index: HighLevelInstructionIndex, + _expr_index: HighLevelExpressionIndex, _tokens: &HighLevelILTokenEmitter, ) { } @@ -109,7 +109,7 @@ impl LanguageRepresentationFunction for MyLangRepr { fn end_lines( &self, _il: &HighLevelILFunction, - _expr_index: HighLevelInstructionIndex, + _expr_index: HighLevelExpressionIndex, _tokens: &HighLevelILTokenEmitter, ) { } @@ -149,7 +149,7 @@ fn test_custom_language_representation() { let il = func.high_level_il(false).unwrap(); let settings = DisassemblySettings::new(); - let root_idx = il.root_instruction_index(); + let root_idx = il.root_expression_index(); let result = _repr.linear_lines(&il, root_idx, &settings, false); let output: String = result.iter().map(|dis| dis.to_string()).collect(); assert_eq!( -- cgit v1.3.1