diff --git a/src/protocol/parser/pass_rewriting.rs b/src/protocol/parser/pass_rewriting.rs index 097359f0e0eddc48e4887a0485f0f5cc9d9e74d8..2b1535fd503abe31a50b9c17eec172158a695f0d 100644 --- a/src/protocol/parser/pass_rewriting.rs +++ b/src/protocol/parser/pass_rewriting.rs @@ -232,10 +232,12 @@ impl Visitor for PassRewriting { let case_num_ports = case.involved_ports.len(); for case_port_index in 0..case_num_ports { - // Arguments to runtime call - let original_get_call_id = case.involved_ports[case_port_index].0; + // Retrieve original span in case of error reporting for the + // inserted function call + let original_get_call_id = ctx.heap[id].cases[case_index].involved_ports[case_port_index].0; let original_get_call_span = ctx.heap[original_get_call_id].full_span; + // Arguments to runtime call let (port_variable_id, port_variable_type) = locals[total_port_index]; // so far this variable contains the temporary variables for the port expressions let case_index_expr_id = create_ast_literal_integer_expr(ctx, self.current_procedure_id, case_index as u64, ctx.arch.uint32_type_id); let port_index_expr_id = create_ast_literal_integer_expr(ctx, self.current_procedure_id, case_port_index as u64, ctx.arch.uint32_type_id);