github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/cover/func.go (about) 1 // Copyright 2013 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // このファイルは、各関数に対して(行、列)-(行-列)の範囲を計算するビジターを実装します。 6 7 package main 8 9 import ( 10 "github.com/shogo82148/std/go/ast" 11 "github.com/shogo82148/std/go/token" 12 ) 13 14 // FuncExtentはソース内の関数の範囲をファイルと位置で説明します。 15 type FuncExtent struct { 16 name string 17 startLine int 18 startCol int 19 endLine int 20 endCol int 21 } 22 23 // FuncVisitorは、ファイルの関数の位置リストを構築するための訪問者を実装します。 24 type FuncVisitor struct { 25 fset *token.FileSet 26 name string 27 astFile *ast.File 28 funcs []*FuncExtent 29 } 30 31 // Visit は ast.Visitor インターフェースを実装します。 32 func (v *FuncVisitor) Visit(node ast.Node) ast.Visitor 33 34 // Pkgは単一のパッケージを説明します。 'go list'のJSON出力と互換性があります。 'go help list'を参照してください。 35 type Pkg struct { 36 ImportPath string 37 Dir string 38 Error *struct { 39 Err string 40 } 41 }