Lines Matching defs:File
3 // license that can be found in the LICENSE file.
62 // file targets. The distinction affects which checks are run.
139 // Each of these vars has a corresponding case in (*File).Visit.
157 checkers = make(map[ast.Node]map[string]func(*File, ast.Node))
160 func register(name, usage string, fn func(*File, ast.Node), types ...ast.Node) {
165 m = make(map[string]func(*File, ast.Node))
185 // File is a wrapper for the state of a file used in the parser.
187 type File struct {
192 file *ast.File
205 checkers map[ast.Node][]func(*File, ast.Node)
315 return nil, fmt.Errorf("unknown package file for import %q", path)
321 file := v.PackageFile[path]
322 if file == "" {
326 return nil, fmt.Errorf("unknown package file for %q", path)
328 f, err := os.Open(file)
335 // doPackageCfg analyzes a single package described in a config file.
391 files []*File
398 var files []*File
399 var astFiles []*ast.File
409 var parsedFile *ast.File
418 files = append(files, &File{
422 file: parsedFile,
453 chk := make(map[ast.Node][]func(*File, ast.Node))
461 for _, file := range files {
462 file.pkg = pkg
463 file.basePkg = basePkg
464 file.checkers = chk
465 if file.file != nil {
466 file.walkFile(file.name, file.file)
531 func (f *File) Bad(pos token.Pos, args ...interface{}) {
537 func (f *File) Badf(pos token.Pos, format string, args ...interface{}) {
543 func (f *File) loc(pos token.Pos) string {
555 func (f *File) locPrefix(pos token.Pos) string {
563 func (f *File) Warn(pos token.Pos, args ...interface{}) {
568 func (f *File) Warnf(pos token.Pos, format string, args ...interface{}) {
572 // walkFile walks the file's tree.
573 func (f *File) walkFile(name string, file *ast.File) {
574 Println("Checking file", name)
575 ast.Walk(f, file)
579 func (f *File) Visit(node ast.Node) ast.Visitor {
617 File) gofmt(x ast.Expr) string {