]> Repositorios git - scryer-prolog.git/commitdiff
use find_inner_choice_instr when appending an indexed clause to an indexed subsequence
authorMark Thom <[email protected]>
Wed, 3 Feb 2021 08:22:13 +0000 (01:22 -0700)
committerMark Thom <[email protected]>
Wed, 3 Feb 2021 08:22:13 +0000 (01:22 -0700)
src/machine/compile.rs

index 13ac32c5e2d2d9d05f97d315dd54c5f757761638..2d05ae3430bb84689c968ba03d7844d051ecd996 100644 (file)
@@ -1001,22 +1001,22 @@ fn append_compiled_clause(
                     AppendOrPrepend::Append,
                 );
 
-                if lower_bound + 1 == target_pos {
-                    let lower_bound_clause_start = find_inner_choice_instr(
-                        code,
-                        skeleton.clauses[lower_bound].clause_start,
-                        index_loc,
-                    );
+                let target_pos_clause_start = find_inner_choice_instr(
+                    code,
+                    skeleton.clauses[target_pos - 1].clause_start,
+                    index_loc,
+                );
 
+                if lower_bound + 1 == target_pos {
                     set_switch_var_offset(
                         code,
                         index_loc,
-                        lower_bound_clause_start - index_loc,
+                        target_pos_clause_start - index_loc,
                         retraction_info,
                     );
                 }
 
-                skeleton.clauses[target_pos - 1].clause_start
+                target_pos_clause_start // skeleton.clauses[target_pos - 1].clause_start
             }
             _ => {
                 skeleton.clauses[target_pos].opt_arg_index_key += clause_loc;