@@ -189,10 +189,10 @@ func (c *funcContext) zeroValue(ty types.Type) string {
189
189
}
190
190
191
191
func (c * funcContext ) newVariable (name string ) string {
192
- return c .newVariableWithLevel (name , false , "" )
192
+ return c .newVariableWithLevel (name , false )
193
193
}
194
194
195
- func (c * funcContext ) newVariableWithLevel (name string , pkgLevel bool , initializer string ) string {
195
+ func (c * funcContext ) newVariableWithLevel (name string , pkgLevel bool ) string {
196
196
if name == "" {
197
197
panic ("newVariable: empty name" )
198
198
}
@@ -238,10 +238,6 @@ func (c *funcContext) newVariableWithLevel(name string, pkgLevel bool, initializ
238
238
return varName
239
239
}
240
240
241
- if initializer != "" {
242
- c .localVars = append (c .localVars , varName + " = " + initializer )
243
- return varName
244
- }
245
241
c .localVars = append (c .localVars , varName )
246
242
return varName
247
243
}
@@ -282,7 +278,7 @@ func (c *funcContext) objectName(o types.Object) string {
282
278
283
279
name , found := c .p .objectVars [o ]
284
280
if ! found {
285
- name = c .newVariableWithLevel (o .Name (), o .Parent () == c .p .Pkg .Scope (), "" )
281
+ name = c .newVariableWithLevel (o .Name (), o .Parent () == c .p .Pkg .Scope ())
286
282
c .p .objectVars [o ] = name
287
283
}
288
284
@@ -310,7 +306,7 @@ func (c *funcContext) typeName(ty types.Type) string {
310
306
anonType , ok := c .p .anonTypeMap .At (ty ).(* types.TypeName )
311
307
if ! ok {
312
308
c .initArgs (ty ) // cause all embedded types to be registered
313
- varName := c .newVariableWithLevel (strings .ToLower (typeKind (ty )[5 :])+ "Type" , true , "" )
309
+ varName := c .newVariableWithLevel (strings .ToLower (typeKind (ty )[5 :])+ "Type" , true )
314
310
anonType = types .NewTypeName (token .NoPos , c .p .Pkg , varName , ty ) // fake types.TypeName
315
311
c .p .anonTypes = append (c .p .anonTypes , anonType )
316
312
c .p .anonTypeMap .Set (ty , anonType )
0 commit comments