@@ -96,6 +96,7 @@ pub enum SimpleLine {
9696 condition : SimpleExpr ,
9797 then_branch : Vec < Self > ,
9898 else_branch : Vec < Self > ,
99+ line_number : SourceLineNumber ,
99100 } ,
100101 TestZero {
101102 // Test that the result of the given operation is zero
@@ -107,6 +108,7 @@ pub enum SimpleLine {
107108 function_name : String ,
108109 args : Vec < SimpleExpr > ,
109110 return_data : Vec < Var > ,
111+ line_number : SourceLineNumber ,
110112 } ,
111113 FunctionRet {
112114 return_data : Vec < SimpleExpr > ,
@@ -316,7 +318,7 @@ fn simplify_lines(
316318 const_malloc,
317319 ) ;
318320 }
319- Line :: Assert ( boolean) => match boolean {
321+ Line :: Assert ( boolean, line_number ) => match boolean {
320322 Boolean :: Different { left, right } => {
321323 let left = simplify_expr ( left, & mut res, counters, array_manager, const_malloc) ;
322324 let right =
@@ -333,6 +335,7 @@ fn simplify_lines(
333335 condition : diff_var. into ( ) ,
334336 then_branch : vec ! [ ] ,
335337 else_branch : vec ! [ SimpleLine :: Panic ] ,
338+ line_number : * line_number,
336339 } ) ;
337340 }
338341 Boolean :: Equal { left, right } => {
@@ -358,6 +361,7 @@ fn simplify_lines(
358361 condition,
359362 then_branch,
360363 else_branch,
364+ line_number,
361365 } => {
362366 let ( condition_simplified, then_branch, else_branch) = match condition {
363367 Condition :: Comparison ( condition) => {
@@ -468,6 +472,7 @@ fn simplify_lines(
468472 condition : condition_simplified,
469473 then_branch : then_branch_simplified,
470474 else_branch : else_branch_simplified,
475+ line_number : * line_number,
471476 } ) ;
472477 }
473478 Line :: ForLoop {
@@ -575,6 +580,7 @@ fn simplify_lines(
575580 // Create recursive function body
576581 let recursive_func = create_recursive_function (
577582 func_name. clone ( ) ,
583+ * line_number,
578584 func_args,
579585 iterator. clone ( ) ,
580586 end_simplified,
@@ -591,12 +597,14 @@ fn simplify_lines(
591597 function_name : func_name,
592598 args : call_args,
593599 return_data : vec ! [ ] ,
600+ line_number : * line_number,
594601 } ) ;
595602 }
596603 Line :: FunctionCall {
597604 function_name,
598605 args,
599606 return_data,
607+ line_number,
600608 } => {
601609 let simplified_args = args
602610 . iter ( )
@@ -606,6 +614,7 @@ fn simplify_lines(
606614 function_name : function_name. clone ( ) ,
607615 args : simplified_args,
608616 return_data : return_data. clone ( ) ,
617+ line_number : * line_number,
609618 } ) ;
610619 }
611620 Line :: FunctionRet { return_data } => {
@@ -873,6 +882,7 @@ pub fn find_variable_usage(lines: &[Line]) -> (BTreeSet<Var>, BTreeSet<Var>) {
873882 condition,
874883 then_branch,
875884 else_branch,
885+ line_number : _,
876886 } => {
877887 on_new_condition ( condition, & internal_vars, & mut external_vars) ;
878888
@@ -895,7 +905,7 @@ pub fn find_variable_usage(lines: &[Line]) -> (BTreeSet<Var>, BTreeSet<Var>) {
895905 }
896906 internal_vars. extend ( return_data. iter ( ) . cloned ( ) ) ;
897907 }
898- Line :: Assert ( condition) => {
908+ Line :: Assert ( condition, _line_number ) => {
899909 on_new_condition (
900910 & Condition :: Comparison ( condition. clone ( ) ) ,
901911 & internal_vars,
@@ -1042,6 +1052,7 @@ pub fn inline_lines(
10421052 condition,
10431053 then_branch,
10441054 else_branch,
1055+ line_number : _,
10451056 } => {
10461057 inline_condition ( condition) ;
10471058
@@ -1060,7 +1071,7 @@ pub fn inline_lines(
10601071 inline_internal_var ( return_var) ;
10611072 }
10621073 }
1063- Line :: Assert ( condition) => {
1074+ Line :: Assert ( condition, _line_number ) => {
10641075 inline_comparison ( condition) ;
10651076 }
10661077 Line :: FunctionRet { return_data } => {
@@ -1237,6 +1248,7 @@ fn handle_array_assignment(
12371248
12381249fn create_recursive_function (
12391250 name : String ,
1251+ line_number : SourceLineNumber ,
12401252 args : Vec < Var > ,
12411253 iterator : Var ,
12421254 end : SimpleExpr ,
@@ -1260,6 +1272,7 @@ fn create_recursive_function(
12601272 function_name : name. clone ( ) ,
12611273 args : recursive_args,
12621274 return_data : vec ! [ ] ,
1275+ line_number,
12631276 } ) ;
12641277 body. push ( SimpleLine :: FunctionRet {
12651278 return_data : vec ! [ ] ,
@@ -1280,6 +1293,7 @@ fn create_recursive_function(
12801293 else_branch: vec![ SimpleLine :: FunctionRet {
12811294 return_data: vec![ ] ,
12821295 } ] ,
1296+ line_number,
12831297 } ,
12841298 ] ;
12851299
@@ -1419,7 +1433,10 @@ fn replace_vars_for_unroll(
14191433 internal_vars,
14201434 ) ;
14211435 }
1422- Line :: Assert ( Boolean :: Equal { left, right } | Boolean :: Different { left, right } ) => {
1436+ Line :: Assert (
1437+ Boolean :: Equal { left, right } | Boolean :: Different { left, right } ,
1438+ _line_number,
1439+ ) => {
14231440 replace_vars_for_unroll_in_expr (
14241441 left,
14251442 iterator,
@@ -1439,6 +1456,7 @@ fn replace_vars_for_unroll(
14391456 condition,
14401457 then_branch,
14411458 else_branch,
1459+ line_number : _,
14421460 } => {
14431461 match condition {
14441462 Condition :: Comparison (
@@ -1523,6 +1541,7 @@ fn replace_vars_for_unroll(
15231541 function_name : _,
15241542 args,
15251543 return_data,
1544+ line_number : _,
15261545 } => {
15271546 // Function calls are not unrolled, so we don't need to change them
15281547 for arg in args {
@@ -1713,6 +1732,7 @@ fn handle_inlined_functions_helper(
17131732 function_name,
17141733 args,
17151734 return_data,
1735+ line_number : _,
17161736 } => {
17171737 if let Some ( func) = inlined_functions. get ( & * function_name) {
17181738 let mut inlined_lines = vec ! [ ] ;
@@ -1864,6 +1884,7 @@ fn handle_const_arguments_helper(
18641884 function_name,
18651885 args,
18661886 return_data : _,
1887+ line_number : _,
18671888 } => {
18681889 if let Some ( func) = constant_functions. get ( function_name) {
18691890 // If the function has constant arguments, we need to handle them
@@ -2055,6 +2076,7 @@ fn replace_vars_by_const_in_lines(lines: &mut [Line], map: &BTreeMap<Var, F>) {
20552076 condition,
20562077 then_branch,
20572078 else_branch,
2079+ line_number : _,
20582080 } => {
20592081 match condition {
20602082 Condition :: Comparison ( Boolean :: Equal { left, right } )
@@ -2076,7 +2098,7 @@ fn replace_vars_by_const_in_lines(lines: &mut [Line], map: &BTreeMap<Var, F>) {
20762098 replace_vars_by_const_in_expr ( end, map) ;
20772099 replace_vars_by_const_in_lines ( body, map) ;
20782100 }
2079- Line :: Assert ( condition) => match condition {
2101+ Line :: Assert ( condition, _line_number ) => match condition {
20802102 Boolean :: Equal { left, right } | Boolean :: Different { left, right } => {
20812103 replace_vars_by_const_in_expr ( left, map) ;
20822104 replace_vars_by_const_in_expr ( right, map) ;
@@ -2216,6 +2238,7 @@ impl SimpleLine {
22162238 condition,
22172239 then_branch,
22182240 else_branch,
2241+ line_number : _,
22192242 } => {
22202243 let then_str = then_branch
22212244 . iter ( )
@@ -2241,6 +2264,7 @@ impl SimpleLine {
22412264 function_name,
22422265 args,
22432266 return_data,
2267+ line_number : _,
22442268 } => {
22452269 let args_str = args
22462270 . iter ( )
0 commit comments