Add reverse mapping for PlutusData constr
This commit is contained in:
parent
0ae631a1fe
commit
4bd8ab890a
|
@ -313,9 +313,19 @@ impl Constant {
|
|||
// This feels a little awkward here; not sure if it should be upstreamed to pallas
|
||||
fn to_doc_list_plutus_data(data: &PlutusData) -> RcDoc<()> {
|
||||
match data {
|
||||
PlutusData::Constr(Constr { tag, fields, .. }) => RcDoc::text("Constr")
|
||||
PlutusData::Constr(Constr {
|
||||
tag,
|
||||
any_constructor,
|
||||
fields,
|
||||
..
|
||||
}) => RcDoc::text("Constr")
|
||||
.append(RcDoc::space())
|
||||
.append(RcDoc::as_string(tag))
|
||||
.append(RcDoc::as_string(match tag {
|
||||
121..=127 => tag - 121,
|
||||
1280..=1400 => tag - 1280 + 7,
|
||||
102 => any_constructor.unwrap(),
|
||||
_ => panic!("unknown tag {}", tag),
|
||||
}))
|
||||
.append(RcDoc::space())
|
||||
.append(RcDoc::text("["))
|
||||
.append(RcDoc::intersperse(
|
||||
|
|
Loading…
Reference in New Issue