process takes the contents of f.Specs and uses them to populate f.Identities
()
| 322 | // process takes the contents of f.Specs and |
| 323 | // uses them to populate f.Identities |
| 324 | func (fs *FileSet) process() { |
| 325 | deferred := make(linkset) |
| 326 | parse: |
| 327 | for name, def := range fs.Specs { |
| 328 | pushstate(name) |
| 329 | el := fs.parseExpr(def) |
| 330 | if el == nil { |
| 331 | warnf("failed to parse") |
| 332 | popstate() |
| 333 | continue parse |
| 334 | } |
| 335 | el.AlwaysPtr(&fs.pointerRcv) |
| 336 | |
| 337 | // Apply type parameters if available |
| 338 | if typeInfo, ok := fs.TypeInfos[name]; ok && typeInfo.TypeParams != nil { |
| 339 | typeParamsStr := formatTypeParams(typeInfo.TypeParams) |
| 340 | ptrMap := getMspTypeParams(typeInfo.TypeParams) |
| 341 | if typeParamsStr != "" && ptrMap != nil { |
| 342 | el.SetTypeParams(gen.GenericTypeParams{ |
| 343 | TypeParams: typeParamsStr, |
| 344 | ToPointerMap: ptrMap, |
| 345 | }) |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | // push unresolved identities into |
| 350 | // the graph of links and resolve after |
| 351 | // we've handled every possible named type. |
| 352 | if be, ok := el.(*gen.BaseElem); ok && be.Value == gen.IDENT { |
| 353 | deferred[name] = be |
| 354 | popstate() |
| 355 | continue parse |
| 356 | } |
| 357 | el.Alias(name) |
| 358 | fs.Identities[name] = el |
| 359 | popstate() |
| 360 | } |
| 361 | |
| 362 | if len(deferred) > 0 { |
| 363 | fs.resolve(deferred) |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | func strToMethod(s string) gen.Method { |
| 368 | switch s { |
no test coverage detected