| 324 | } |
| 325 | |
| 326 | func (l *loader) loadType(dt parser.Type, dec parser.Declaration) string { |
| 327 | // TODO: Error out for certain built-ins (e.g. chan) |
| 328 | if dec.Kind() == parser.KindBuiltin { |
| 329 | return dt.String() |
| 330 | } |
| 331 | // Find the import path |
| 332 | importPath, err := dec.Package().Import() |
| 333 | if err != nil { |
| 334 | l.Bail(err) |
| 335 | } |
| 336 | // Standard library |
| 337 | if gois.StdLib(importPath) { |
| 338 | dt := parser.Requalify(dt, imports.AssumedName(importPath)) |
| 339 | return dt.String() |
| 340 | } |
| 341 | // Add the type's import |
| 342 | name := l.imports.Add(importPath) |
| 343 | dt = parser.Qualify(dt, name) |
| 344 | return dt.String() |
| 345 | } |
| 346 | |
| 347 | func (l *loader) loadActionInput(params []*ActionParam) string { |
| 348 | if len(params) == 1 && params[0].Kind == string(parser.KindStruct) { |