Decompile a Constructor. Constructor metadata is in its own ConstantMetaInfo::Ctor (resolved from Named entries).
( ctor: &Constructor, meta: &ConstantMeta, induct_name: Name, cache: &mut BlockCache, stt: &CompileState, dstt: &DecompileState, )
| 1473 | /// Extract level param names from ConstantMeta. |
| 1474 | fn decompile_level_names_from_meta( |
| 1475 | meta: &ConstantMeta, |
| 1476 | stt: &CompileState, |
| 1477 | ) -> Result<Vec<Name>, DecompileError> { |
| 1478 | get_lvls_from_meta(meta).iter().map(|a| decompile_name(a, stt)).collect() |
| 1479 | } |
| 1480 | |
| 1481 | // =========================================================================== |
| 1482 | // Constant decompilation |
| 1483 | // =========================================================================== |
| 1484 | |
| 1485 | /// Decompile a ConstantVal (name, level_params, type). |
| 1486 | fn decompile_const_val( |
| 1487 | typ: &Arc<Expr>, |
| 1488 | meta: &ConstantMeta, |
| 1489 | cache: &mut BlockCache, |
| 1490 | stt: &CompileState, |
| 1491 | dstt: &DecompileState, |
| 1492 | ) -> Result<ConstantVal, DecompileError> { |
| 1493 | let name = decompile_name_from_meta(meta, stt)?; |
| 1494 | let level_params = decompile_level_names_from_meta(meta, stt)?; |
| 1495 | let (arena, type_root) = get_arena_and_type_root(meta); |
| 1496 | let typ = |
| 1497 | decompile_expr(typ, arena, type_root, &level_params, cache, stt, dstt)?; |
| 1498 | Ok(ConstantVal { name, level_params, typ }) |
| 1499 | } |
| 1500 | |
| 1501 | /// Decompile a Definition. |
| 1502 | fn decompile_definition( |
| 1503 | def: &Definition, |
| 1504 | meta: &ConstantMeta, |
| 1505 | cache: &mut BlockCache, |
| 1506 | stt: &CompileState, |
| 1507 | dstt: &DecompileState, |
| 1508 | ) -> Result<LeanConstantInfo, DecompileError> { |
| 1509 | let name = decompile_name_from_meta(meta, stt)?; |
| 1510 | let level_params = decompile_level_names_from_meta(meta, stt)?; |
no test coverage detected