install asserted predicates into modules from initialization directives (#222)
This commit is contained in:
@@ -277,19 +277,19 @@ pub fn compile_term(wam: &mut Machine, packet: TopLevelPacket) -> EvalSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_module_indices(wam: &Machine, module_name: ClauseName, mut indices: IndexStore) {
|
fn update_module_indices(wam: &mut Machine, module_name: ClauseName, mut indices: IndexStore) {
|
||||||
match wam.indices.modules.get(&module_name) {
|
match wam.indices.modules.get_mut(&module_name) {
|
||||||
Some(module) => {
|
Some(ref mut module) => {
|
||||||
let code_dir = mem::replace(&mut indices.code_dir, CodeDir::new());
|
let code_dir = mem::replace(&mut indices.code_dir, CodeDir::new());
|
||||||
|
|
||||||
// replace the "user" module src's in the indices with module_name.
|
// replace the "user" module src's in the indices with module_name.
|
||||||
for (key, idx) in code_dir.iter() {
|
for (key, idx) in code_dir.iter() {
|
||||||
let p = idx.0.borrow().0;
|
let p = idx.0.borrow().0;
|
||||||
|
|
||||||
match module.code_dir.get(&key) {
|
let idx = CodeIndex::dynamic_undefined(module_name.clone());
|
||||||
Some(idx) => set_code_index!(idx, p, module_name.clone()),
|
let idx = module.code_dir.entry(key.clone()).or_insert(idx);
|
||||||
_ => {}
|
|
||||||
}
|
set_code_index!(idx, p, module_name.clone());
|
||||||
|
|
||||||
match wam.indices.code_dir.get(&key) {
|
match wam.indices.code_dir.get(&key) {
|
||||||
Some(idx) => {
|
Some(idx) => {
|
||||||
@@ -419,6 +419,7 @@ impl ClauseCodeGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// compiles the latest version of clause/2.
|
||||||
fn generate_clause_code(
|
fn generate_clause_code(
|
||||||
&mut self,
|
&mut self,
|
||||||
dynamic_clause_map: &DynamicClauseMap,
|
dynamic_clause_map: &DynamicClauseMap,
|
||||||
|
|||||||
@@ -184,7 +184,8 @@ impl Machine {
|
|||||||
Ok(p) => {
|
Ok(p) => {
|
||||||
self.machine_st.attr_var_init.verify_attrs_loc = p;
|
self.machine_st.attr_var_init.verify_attrs_loc = p;
|
||||||
}
|
}
|
||||||
Err(_) => panic!("Machine::compile_special_forms() failed at VERIFY_ATTRS"),
|
Err(_) =>
|
||||||
|
panic!("Machine::compile_special_forms() failed at VERIFY_ATTRS"),
|
||||||
}
|
}
|
||||||
|
|
||||||
match compile_special_form(self, parsing_stream(PROJECT_ATTRS.as_bytes()), project_attrs_src)
|
match compile_special_form(self, parsing_stream(PROJECT_ATTRS.as_bytes()), project_attrs_src)
|
||||||
@@ -192,7 +193,8 @@ impl Machine {
|
|||||||
Ok(p) => {
|
Ok(p) => {
|
||||||
self.machine_st.attr_var_init.project_attrs_loc = p;
|
self.machine_st.attr_var_init.project_attrs_loc = p;
|
||||||
}
|
}
|
||||||
Err(e) => panic!("Machine::compile_special_forms() failed at PROJECT_ATTRS: {}", e),
|
Err(e) =>
|
||||||
|
panic!("Machine::compile_special_forms() failed at PROJECT_ATTRS: {}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user