LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // This file contains the exported entry points for invoking the parser. | 5 // This file contains the exported entry points for invoking the parser. |
6 | 6 |
7 package parser | 7 package parser |
8 | 8 |
9 import ( | 9 import ( |
10 "bytes" | 10 "bytes" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 153 } |
154 | 154 |
155 pkgs := make(map[string]*ast.Package) | 155 pkgs := make(map[string]*ast.Package) |
156 for i := 0; i < len(list); i++ { | 156 for i := 0; i < len(list); i++ { |
157 entry := &list[i] | 157 entry := &list[i] |
158 if filter == nil || filter(entry) { | 158 if filter == nil || filter(entry) { |
159 src, err := ParseFile(pathutil.Join(path, entry.Name), n
il, mode) | 159 src, err := ParseFile(pathutil.Join(path, entry.Name), n
il, mode) |
160 if err != nil { | 160 if err != nil { |
161 return pkgs, err | 161 return pkgs, err |
162 } | 162 } |
163 » » » name := src.Name.Value() | 163 » » » name := src.Name.Name() |
164 pkg, found := pkgs[name] | 164 pkg, found := pkgs[name] |
165 if !found { | 165 if !found { |
166 pkg = &ast.Package{name, path, make(map[string]*
ast.File)} | 166 pkg = &ast.Package{name, path, make(map[string]*
ast.File)} |
167 pkgs[name] = pkg | 167 pkgs[name] = pkg |
168 } | 168 } |
169 pkg.Files[entry.Name] = src | 169 pkg.Files[entry.Name] = src |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 return pkgs, nil | 173 return pkgs, nil |
174 } | 174 } |
LEFT | RIGHT |