diff options
| author | Mason Reed <mason@vector35.com> | 2025-05-30 16:39:32 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-05-30 19:17:10 -0400 |
| commit | 68b00cdf45551ba64c4f7217963055fc5a1a0cc4 (patch) | |
| tree | f6bdef06bc02d16596bdf62870c8a1cfafe49859 /rust/tests/language_representation.rs | |
| parent | 77ab5e812af200b8e3bca0aac31d5fe0f638fba3 (diff) | |
[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
Diffstat (limited to 'rust/tests/language_representation.rs')
| -rw-r--r-- | rust/tests/language_representation.rs | 10 |
1 files changed, 5 insertions, 5 deletions
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!( |
