MCPcopy
hub / github.com/google/mangle / ExtractPackages

Function ExtractPackages

analysis/validation.go:108–123  ·  view source on GitHub ↗

ExtractPackages turns source units into merged source packages.

(program []parse.SourceUnit)

Source from the content-addressed store, hash-verified

106
107// ExtractPackages turns source units into merged source packages.
108func ExtractPackages(program []parse.SourceUnit) (map[string]*packages.Package, error) {
109 pkgs := map[string]*packages.Package{}
110 for _, unit := range program {
111 p, err := packages.Extract(unit)
112 if err != nil {
113 return nil, err
114 }
115 pkg, ok := pkgs[p.Name]
116 if ok {
117 pkg.Merge(p)
118 } else {
119 pkgs[p.Name] = &p
120 }
121 }
122 return pkgs, nil
123}
124
125// AnalyzeAndCheckBounds checks every rule, including bounds.
126func AnalyzeAndCheckBounds(program []parse.SourceUnit, extraPredicates map[ast.PredicateSym]ast.Decl, boundsChecking BoundsCheckingMode) (*ProgramInfo, error) {

Callers 1

AnalyzeAndCheckBoundsFunction · 0.85

Calls 2

ExtractFunction · 0.92
MergeMethod · 0.65

Tested by

no test coverage detected