2024-12-17 07:10:47 -05:00
|
|
|
use std::{ops::Range, panic};
|
2024-12-10 01:34:53 -05:00
|
|
|
|
2025-02-03 17:49:38 -05:00
|
|
|
use crate::vm::Thread;
|
2024-12-10 01:34:53 -05:00
|
|
|
|
2025-02-03 17:49:38 -05:00
|
|
|
pub fn panic(data: &mut Thread, _: usize, argument_range: Range<usize>) {
|
2025-01-09 05:31:45 -05:00
|
|
|
let position = data.current_position();
|
2024-12-17 07:10:47 -05:00
|
|
|
let mut message = format!("Dust panic at {position}!");
|
2024-12-10 01:34:53 -05:00
|
|
|
|
2024-12-17 07:10:47 -05:00
|
|
|
for register_index in argument_range {
|
2025-02-05 19:12:26 -05:00
|
|
|
let string = data.get_string_register(register_index);
|
2024-12-10 01:34:53 -05:00
|
|
|
|
2025-01-09 05:31:45 -05:00
|
|
|
message.push_str(&string);
|
|
|
|
message.push('\n');
|
2024-12-10 01:34:53 -05:00
|
|
|
}
|
|
|
|
|
2024-12-17 07:10:47 -05:00
|
|
|
panic!("{}", message)
|
2024-12-10 01:34:53 -05:00
|
|
|
}
|