Skip to content

Commit 28ea4b8

Browse files
authored
refactor: use def-indef constructor for data types when decoding (#136)
Signed-off-by: Aurora Gaffney <[email protected]>
1 parent c2e732f commit 28ea4b8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

data/decode.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ func decodeCborRawList(data []byte) (any, error) {
9393
}
9494
tmpItems[i] = tmpPd
9595
}
96-
ret := NewList(tmpItems...)
97-
ret.(*List).useIndef = &useIndef
96+
ret := NewListDefIndef(useIndef, tmpItems...)
9897
return ret, nil
9998
}
10099

@@ -165,8 +164,7 @@ func decodeCborRawMap(data []byte) (any, error) {
165164
},
166165
)
167166
}
168-
ret := NewMap(pairs)
169-
ret.(*Map).useIndef = &useIndef
167+
ret := NewMapDefIndef(useIndef, pairs)
170168
return ret, nil
171169
}
172170

@@ -308,8 +306,7 @@ func decodeConstr(tag uint64, content cbor.RawMessage) (PlutusData, error) {
308306

309307
fields := tmpList.Items
310308

311-
ret := NewConstr(uint(tag), fields...)
312-
ret.(*Constr).useIndef = tmpList.useIndef
309+
ret := NewConstrDefIndef(*(tmpList.useIndef), uint(tag), fields...)
313310
return ret, nil
314311
}
315312

0 commit comments

Comments
 (0)