@@ -252,6 +252,7 @@ type typeInfo struct {
252
252
IsPointer bool
253
253
IsStdOrBuiltin bool
254
254
Deps []Identity
255
+ Ty types.Type
255
256
}
256
257
257
258
// FIXME: for complex type like map[XX]YY , we only extract first-meet type here
@@ -284,7 +285,7 @@ func (ctx *fileContext) mockType(typ ast.Expr) typeInfo {
284
285
if err != nil {
285
286
goto fallback
286
287
}
287
- return typeInfo {NewIdentity (mod , PkgPath (impt ), ty .Sel .Name ), false , false , nil }
288
+ return typeInfo {NewIdentity (mod , PkgPath (impt ), ty .Sel .Name ), false , false , nil , nil }
288
289
case * ast.SelectorExpr :
289
290
// recurse
290
291
ti := ctx .mockType (xx )
@@ -295,7 +296,7 @@ func (ctx *fileContext) mockType(typ ast.Expr) typeInfo {
295
296
}
296
297
297
298
fallback:
298
- return typeInfo {NewIdentity ("UNLOADED" , ctx .pkgPath , string (ctx .GetRawContent (typ ))), false , true , nil }
299
+ return typeInfo {NewIdentity ("UNLOADED" , ctx .pkgPath , string (ctx .GetRawContent (typ ))), false , true , nil , nil }
299
300
}
300
301
301
302
func (ctx * fileContext ) collectFields (fields []* ast.Field , m * []Dependency ) {
@@ -453,6 +454,7 @@ func (p *GoParser) collectTypes(ctx *fileContext, typ ast.Expr, st *Type, inline
453
454
func (ctx * fileContext ) getTypeinfo (typ types.Type ) (ti typeInfo ) {
454
455
tobjs , isPointer := getNamedTypes (typ )
455
456
ti .IsPointer = isPointer
457
+ ti .Ty = typ
456
458
if len (tobjs ) > 0 {
457
459
tobj := tobjs [0 ]
458
460
if tp := tobj .Pkg (); tp != nil {
0 commit comments