]> Repositorios git - scryer-prolog.git/commitdiff
detect External indices more generally in internalize_constant (#2395)
authorMark Thom <[email protected]>
Mon, 29 Apr 2024 20:23:14 +0000 (14:23 -0600)
committerMark Thom <[email protected]>
Mon, 29 Apr 2024 20:23:14 +0000 (14:23 -0600)
build/instructions_template.rs
src/indexing.rs

index 7914964f4deb7c618673db128f119bc0b89b924a..86cde2f36e461463e798cb806bbdf6b794afe1f3 100644 (file)
@@ -1017,6 +1017,13 @@ fn generate_instruction_preface() -> TokenStream {
                     },
                 }
             }
+
+            pub fn is_external(&self) -> bool {
+                matches!(
+                    self,
+                    IndexingCodePtr::External(_) | IndexingCodePtr::DynamicExternal(_)
+                )
+            }
         }
 
         impl IndexingInstruction {
index 4eb39e2de50726c8afadd02cc354882ceff9408d..2df0553086b37d7e2337397c06697f89278c597f 100644 (file)
@@ -114,13 +114,13 @@ impl<'a> IndexingCodeMergingPtr<'a> {
             Some(OptArgIndexKey::Literal(_, _, constant, _)) => {
                 constants.insert(*constant, constant_ptr);
             }
+            _ if constant_ptr.is_external() => {
+                // this must be a defunct clause, because it's been deleted
+                // from the skeleton.
+                debug_assert!(constant_key.is_none());
+            }
             _ => {
-                if let IndexingCodePtr::DynamicExternal(_) = constant_ptr {
-                    // this must be a defunct clause, because it's been deleted
-                    // from the skeleton.
-                } else {
-                    unreachable!()
-                }
+                unreachable!()
             }
         }