Skip to content

Commit 9fbbfdc

Browse files
committed
wit/bindgen: call v.Types() once
1 parent e29efea commit 9fbbfdc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

wit/bindgen/generator.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,11 +880,12 @@ func (g *generator) variantRep(file *gen.File, dir wit.Direction, t *wit.TypeDef
880880
}
881881

882882
disc := wit.Discriminant(len(v.Cases))
883-
shape := variantShape(v.Types())
884-
align := variantAlign(v.Types())
883+
types := v.Types()
884+
shape := variantShape(types)
885+
align := variantAlign(types)
885886

886887
var typeShape string
887-
if len(v.Types()) == 1 {
888+
if len(types) == 1 {
888889
typeShape = g.typeRep(file, dir, shape)
889890
} else {
890891
typeShape = g.typeShape(file, dir, shape)

0 commit comments

Comments
 (0)