diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-07-04 11:12:55 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-07-04 15:05:30 +0200 |
| commit | c7d7f10bdff703e4a3c0414e8a33d4e45c91eb35 (patch) | |
| tree | 0dff0ee1f98dbfa3ad8776112053a450d176592b /vendor/github.com/go-toolsmith/astp/decl.go | |
| parent | 9573094ce235bd9afe88f5da27a47dd6bcc1e13b (diff) | |
go.mod: vendor golangci-lint
Diffstat (limited to 'vendor/github.com/go-toolsmith/astp/decl.go')
| -rw-r--r-- | vendor/github.com/go-toolsmith/astp/decl.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/github.com/go-toolsmith/astp/decl.go b/vendor/github.com/go-toolsmith/astp/decl.go new file mode 100644 index 000000000..4654ad95c --- /dev/null +++ b/vendor/github.com/go-toolsmith/astp/decl.go @@ -0,0 +1,39 @@ +package astp + +import "go/ast" + +// IsDecl reports whether a node is a ast.Decl. +func IsDecl(node ast.Node) bool { + _, ok := node.(ast.Decl) + return ok +} + +// IsFuncDecl reports whether a given ast.Node is a function declaration (*ast.FuncDecl). +func IsFuncDecl(node ast.Node) bool { + _, ok := node.(*ast.FuncDecl) + return ok +} + +// IsGenDecl reports whether a given ast.Node is a generic declaration (*ast.GenDecl). +func IsGenDecl(node ast.Node) bool { + _, ok := node.(*ast.GenDecl) + return ok +} + +// IsImportSpec reports whether a given ast.Node is an import declaration (*ast.ImportSpec). +func IsImportSpec(node ast.Node) bool { + _, ok := node.(*ast.ImportSpec) + return ok +} + +// IsValueSpec reports whether a given ast.Node is a value declaration (*ast.ValueSpec). +func IsValueSpec(node ast.Node) bool { + _, ok := node.(*ast.ValueSpec) + return ok +} + +// IsTypeSpec reports whether a given ast.Node is a type declaration (*ast.TypeSpec). +func IsTypeSpec(node ast.Node) bool { + _, ok := node.(*ast.TypeSpec) + return ok +} |
