fn override_with_rewrite(&mut self, env: &mut GlobalEnv) -> Result<()> {
        // convert all module specs found in the model
        let mut new_specs = BTreeMap::new();
        for menv in env.get_modules() {
            let mid = menv.get_id();
            if let Some(new_spec) = self.rewrite_module_spec(env, mid, menv.get_spec())? {
                new_specs.insert(mid, new_spec);
            }
        }
        for (mid, spec) in new_specs {
            env.override_module_spec(mid, spec);
        }

        // convert all functional specs found in the model
        let mut new_specs = BTreeMap::new();
        for menv in env.get_modules() {
            for fenv in menv.get_functions() {
                let fid = fenv.get_qualified_id();
                if let Some(new_spec) = self.rewrite_function_spec(env, fid, fenv.get_spec())? {
                    new_specs.insert(fid, new_spec);
                }
            }
        }
        for (fid, spec) in new_specs {
            env.override_function_spec(fid, spec);
        }

        // convert all code-level specs found in the model
        let mut new_specs = BTreeMap::new();
        for menv in env.get_modules() {
            for fenv in menv.get_functions() {
                let fid = fenv.get_qualified_id();
                for (offset, spec) in &fenv.get_spec().on_impl {
                    if let Some(new_spec) = self.rewrite_inline_spec(env, fid, *offset, spec)? {
                        new_specs.insert((fid, *offset), new_spec);
                    }
                }
            }
        }
        for ((fid, offset), spec) in new_specs {
            env.override_inline_spec(fid, offset, spec);
        }
        Ok(())
    }
/// Iterate over the specs in the `GlobalEnv`, rewrite each spec, and apply changes back to the
/// `GlobalEnv`.
Iterate over the specs in the `GlobalEnv`, rewrite each spec, and apply changes back to the
`GlobalEnv`.
Iterate over the specs in the ` GlobalEnv ` rewrite each spec and apply changes back to the ` GlobalEnv ` .
fn override_with_rewrite(&mut self, env: &mut GlobalEnv) -> Result<()> {
        // convert all module specs found in the model
        let mut new_specs = BTreeMap::new();
        for menv in env.get_modules() {
            let mid = menv.get_id();
            if let Some(new_spec) = self.rewrite_module_spec(env, mid, menv.get_spec())? {
                new_specs.insert(mid, new_spec);
            }
        }
        for (mid, spec) in new_specs {
            env.override_module_spec(mid, spec);
        }
        // convert all functional specs found in the model
        let mut new_specs = BTreeMap::new();
        for menv in env.get_modules() {
            for fenv in menv.get_functions() {
                let fid = fenv.get_qualified_id();
                if let Some(new_spec) = self.rewrite_function_spec(env, fid, fenv.get_spec())? {
                    new_specs.insert(fid, new_spec);
                }
            }
        }
        for (fid, spec) in new_specs {
            env.override_function_spec(fid, spec);
        }
        // convert all code-level specs found in the model
        let mut new_specs = BTreeMap::new();
        for menv in env.get_modules() {
            for fenv in menv.get_functions() {
                let fid = fenv.get_qualified_id();
                for (offset, spec) in &fenv.get_spec().on_impl {
                    if let Some(new_spec) = self.rewrite_inline_spec(env, fid, *offset, spec)? {
                        new_specs.insert((fid, *offset), new_spec);
                    }
                }
            }
        }
        for ((fid, offset), spec) in new_specs {
            env.override_inline_spec(fid, offset, spec);
        }
        Ok(())
    }
fn override_with_rewrite ( & mut self , env : & mut GlobalEnv ) -> Result < ( ) > { // convert all module specs found in the model let mut new_specs = BTreeMap :: new ( ) ; for menv in env . get_modules ( ) { let mid = menv . get_id ( ) ; if let Some ( new_spec ) = self . rewrite_module_spec ( env , mid , menv . get_spec ( ) ) ? { new_specs . insert ( mid , new_spec ) ; } } for ( mid , spec ) in new_specs { env . override_module_spec ( mid , spec ) ; } // convert all functional specs found in the model let mut new_specs = BTreeMap :: new ( ) ; for menv in env . get_modules ( ) { for fenv in menv . get_functions ( ) { let fid = fenv . get_qualified_id ( ) ; if let Some ( new_spec ) = self . rewrite_function_spec ( env , fid , fenv . get_spec ( ) ) ? { new_specs . insert ( fid , new_spec ) ; } } } for ( fid , spec ) in new_specs { env . override_function_spec ( fid , spec ) ; } // convert all code-level specs found in the model let mut new_specs = BTreeMap :: new ( ) ; for menv in env . get_modules ( ) { for fenv in menv . get_functions ( ) { let fid = fenv . get_qualified_id ( ) ; for ( offset , spec ) in & fenv . get_spec ( ) . on_impl { if let Some ( new_spec ) = self . rewrite_inline_spec ( env , fid , * offset , spec ) ? { new_specs . insert ( ( fid , * offset ) , new_spec ) ; } } } } for ( ( fid , offset ) , spec ) in new_specs { env . override_inline_spec ( fid , offset , spec ) ; } Ok ( ( ) ) }
Iterate over the specs in the `GlobalEnv`, rewrite each spec, and apply changes back to the
`GlobalEnv`.
Iterate over the specs in the ` GlobalEnv ` rewrite each spec and apply changes back to the ` GlobalEnv ` .
&mut self
env
&mut GlobalEnv