false
}
+fn print_overwrite_warning(
+ compilation_target: &CompilationTarget,
+ code_ptr: IndexPtr,
+ key: &PredicateKey,
+) {
+ if let CompilationTarget::Module(ref module_name) = compilation_target {
+ match module_name.as_str() {
+ "builtins" | "loader" => return,
+ _ => {}
+ }
+ }
+
+ match code_ptr {
+ IndexPtr::DynamicUndefined | IndexPtr::Undefined => return,
+ _ => {}
+ }
+
+ println!("Warning: overwriting {}/{}", key.0, key.1);
+}
+
impl<'a> LoadState<'a> {
fn compile_standalone_clause(
&mut self,
predicates.compilation_target.clone(),
);
}
- }
+ };
match self
.wam
}
}
+ print_overwrite_warning(&predicates.compilation_target, code_index.get(), &key);
+
set_code_index(
&mut self.retraction_info,
&predicates.compilation_target,
code_index.set(code_ptr);
RetractionRecord::AddedUserPredicate(key)
} else {
- // TODO: emit warning about overwriting previous record
let replaced = code_index.replace(code_ptr);
RetractionRecord::ReplacedUserPredicate(key, replaced)
}
code_index.set(code_ptr);
RetractionRecord::AddedModulePredicate(module_name.clone(), key)
} else {
- // TODO: emit warning about overwriting previous record
let replaced = code_index.replace(code_ptr);
RetractionRecord::ReplacedModulePredicate(module_name.clone(), key, replaced)
}