@@ -1124,7 +1124,7 @@ func (g *generator) lowerFlags(file *gen.File, dir wit.Direction, t *wit.TypeDef
1124
1124
}
1125
1125
1126
1126
func (g * generator ) lowerVariant (file * gen.File , dir wit.Direction , t * wit.TypeDef , input string ) string {
1127
- decl , _ := g .typeDecl (dir , t )
1127
+ // decl, _ := g.typeDecl(dir, t)
1128
1128
v := t .Kind .(* wit.Variant )
1129
1129
flat := t .Flat ()
1130
1130
if v .Enum () != nil {
@@ -1139,9 +1139,10 @@ func (g *generator) lowerVariant(file *gen.File, dir wit.Direction, t *wit.TypeD
1139
1139
continue
1140
1140
}
1141
1141
caseNum := strconv .Itoa (i )
1142
- caseName := decl .scope .GetName (GoName (c .Name , true ))
1142
+ // caseName := decl.scope.GetName(GoName(c.Name, true))
1143
+ input := "*" + g .cmCall (abiFile , "Case[" + g .typeRep (file , dir , c .Type )+ "]" , "&v, " + caseNum )
1143
1144
stringio .Write (& b , "case " , caseNum , ": // " , c .Name , "\n " )
1144
- b .WriteString (g .lowerVariantCaseInto (abiFile , dir , c .Type , flat [1 :], "*v." + caseName + "()" ))
1145
+ b .WriteString (g .lowerVariantCaseInto (abiFile , dir , c .Type , flat [1 :], input ))
1145
1146
}
1146
1147
b .WriteString ("}\n " )
1147
1148
b .WriteString ("return\n " )
0 commit comments