Extract components from a parse.SourceUnit type.
(su parse.SourceUnit)
| 237 | |
| 238 | // Extract components from a parse.SourceUnit type. |
| 239 | func Extract(su parse.SourceUnit) (Package, error) { |
| 240 | pkg, err := findPackage(su.Decls) |
| 241 | if err != nil { |
| 242 | return Package{}, err |
| 243 | } |
| 244 | |
| 245 | pkg.units = append(pkg.units, su) |
| 246 | return pkg, nil |
| 247 | } |