Build a RustCondensedBlocks structure.
(
cache: &mut LeanBuildCache,
condensed: &ix_compile::condense::CondensedBlocks,
)
| 37 | impl LeanIxCondensedBlocks<LeanOwned> { |
| 38 | /// Build a RustCondensedBlocks structure. |
| 39 | pub fn build( |
| 40 | cache: &mut LeanBuildCache, |
| 41 | condensed: &ix_compile::condense::CondensedBlocks, |
| 42 | ) -> Self { |
| 43 | // Build lowLinks: Array (Ix.Name × Ix.Name) |
| 44 | let low_links_arr = LeanArray::alloc(condensed.low_links.len()); |
| 45 | for (i, (name, low_link)) in condensed.low_links.iter().enumerate() { |
| 46 | let name_obj = LeanIxName::build(cache, name); |
| 47 | let low_link_obj = LeanIxName::build(cache, low_link); |
| 48 | let pair = LeanProd::new(name_obj, low_link_obj); |
| 49 | low_links_arr.set(i, pair); |
| 50 | } |
| 51 | |
| 52 | // Build blocks: Array (Ix.Name × Array Ix.Name) |
| 53 | let blocks_arr = LeanArray::alloc(condensed.blocks.len()); |
| 54 | for (i, (name, block_set)) in condensed.blocks.iter().enumerate() { |
| 55 | let name_obj = LeanIxName::build(cache, name); |
| 56 | let block_names_arr = LeanArray::alloc(block_set.len()); |
| 57 | for (j, block_name) in block_set.iter().enumerate() { |
| 58 | let block_name_obj = LeanIxName::build(cache, block_name); |
| 59 | block_names_arr.set(j, block_name_obj); |
| 60 | } |
| 61 | let pair = LeanProd::new(name_obj, block_names_arr); |
| 62 | blocks_arr.set(i, pair); |
| 63 | } |
| 64 | |
| 65 | // Build blockRefs: Array (Ix.Name × Array Ix.Name) |
| 66 | let block_refs_arr = LeanArray::alloc(condensed.block_refs.len()); |
| 67 | for (i, (name, ref_set)) in condensed.block_refs.iter().enumerate() { |
| 68 | let name_obj = LeanIxName::build(cache, name); |
| 69 | let refs_arr = LeanArray::alloc(ref_set.len()); |
| 70 | for (j, ref_name) in ref_set.iter().enumerate() { |
| 71 | let ref_name_obj = LeanIxName::build(cache, ref_name); |
| 72 | refs_arr.set(j, ref_name_obj); |
| 73 | } |
| 74 | let pair = LeanProd::new(name_obj, refs_arr); |
| 75 | block_refs_arr.set(i, pair); |
| 76 | } |
| 77 | |
| 78 | // Build RustCondensedBlocks structure (3 fields) |
| 79 | let result = LeanIxCondensedBlocks::alloc(0); |
| 80 | result.set_obj(0, low_links_arr); |
| 81 | result.set_obj(1, blocks_arr); |
| 82 | result.set_obj(2, block_refs_arr); |
| 83 | result |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // ============================================================================= |
no test coverage detected