aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-toolsmith/astcopy
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2023-02-22 22:16:50 +0100
committerTaras Madan <tarasmadan@google.com>2023-02-24 12:47:23 +0100
commit4165372ec8fd142475a4e35fd0cf4f8042132208 (patch)
tree21cd62211b4dd80bee469054c5b65db77342333c /vendor/github.com/go-toolsmith/astcopy
parent2b3ed821a493b8936c8bacfa6f8b4f1c90a00855 (diff)
dependencies: update
set go min requirements to 1.19 update dependencies update vendor
Diffstat (limited to 'vendor/github.com/go-toolsmith/astcopy')
-rw-r--r--vendor/github.com/go-toolsmith/astcopy/.travis.yml9
-rw-r--r--vendor/github.com/go-toolsmith/astcopy/README.md26
-rw-r--r--vendor/github.com/go-toolsmith/astcopy/astcopy.go46
-rw-r--r--vendor/github.com/go-toolsmith/astcopy/astcopy_go117.go30
-rw-r--r--vendor/github.com/go-toolsmith/astcopy/astcopy_go118.go36
-rw-r--r--vendor/github.com/go-toolsmith/astcopy/go.mod9
-rw-r--r--vendor/github.com/go-toolsmith/astcopy/go.sum6
7 files changed, 101 insertions, 61 deletions
diff --git a/vendor/github.com/go-toolsmith/astcopy/.travis.yml b/vendor/github.com/go-toolsmith/astcopy/.travis.yml
deleted file mode 100644
index 8994d395c..000000000
--- a/vendor/github.com/go-toolsmith/astcopy/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: go
-go:
- - 1.x
-install:
- - # Prevent default install action "go get -t -v ./...".
-script:
- - go get -t -v ./...
- - go tool vet .
- - go test -v -race ./... \ No newline at end of file
diff --git a/vendor/github.com/go-toolsmith/astcopy/README.md b/vendor/github.com/go-toolsmith/astcopy/README.md
index 4dae5c41b..7adc66525 100644
--- a/vendor/github.com/go-toolsmith/astcopy/README.md
+++ b/vendor/github.com/go-toolsmith/astcopy/README.md
@@ -1,13 +1,16 @@
-[![Go Report Card](https://goreportcard.com/badge/github.com/go-toolsmith/astcopy)](https://goreportcard.com/report/github.com/go-toolsmith/astcopy)
-[![GoDoc](https://godoc.org/github.com/go-toolsmith/astcopy?status.svg)](https://godoc.org/github.com/go-toolsmith/astcopy)
-[![Build Status](https://travis-ci.org/go-toolsmith/astcopy.svg?branch=master)](https://travis-ci.org/go-toolsmith/astcopy)
-
# astcopy
-Package astcopy implements Go AST reflection-free deep copy operations.
+[![build-img]][build-url]
+[![pkg-img]][pkg-url]
+[![reportcard-img]][reportcard-url]
+[![version-img]][version-url]
+
+Package `astcopy` implements Go AST reflection-free deep copy operations.
## Installation:
+Go version 1.16+
+
```bash
go get github.com/go-toolsmith/astcopy
```
@@ -39,3 +42,16 @@ func main() {
fmt.Println(astequal.Expr(x, y)) // => false
}
```
+
+## License
+
+[MIT License](LICENSE).
+
+[build-img]: https://github.com/go-toolsmith/astp/workflows/build/badge.svg
+[build-url]: https://github.com/go-toolsmith/astp/actions
+[pkg-img]: https://pkg.go.dev/badge/go-toolsmith/astp
+[pkg-url]: https://pkg.go.dev/github.com/go-toolsmith/astp
+[reportcard-img]: https://goreportcard.com/badge/go-toolsmith/astp
+[reportcard-url]: https://goreportcard.com/report/go-toolsmith/astp
+[version-img]: https://img.shields.io/github/v/release/go-toolsmith/astp
+[version-url]: https://github.com/go-toolsmith/astp/releases
diff --git a/vendor/github.com/go-toolsmith/astcopy/astcopy.go b/vendor/github.com/go-toolsmith/astcopy/astcopy.go
index 393c5cabc..72bc58ce6 100644
--- a/vendor/github.com/go-toolsmith/astcopy/astcopy.go
+++ b/vendor/github.com/go-toolsmith/astcopy/astcopy.go
@@ -196,6 +196,18 @@ func IndexExpr(x *ast.IndexExpr) *ast.IndexExpr {
return &cp
}
+// IndexListExpr returns x deep copy.
+// Copy of nil argument is nil.
+func IndexListExpr(x *typeparams.IndexListExpr) *typeparams.IndexListExpr {
+ if x == nil {
+ return nil
+ }
+ cp := *x
+ cp.X = copyExpr(x.X)
+ cp.Indices = ExprList(x.Indices)
+ return &cp
+}
+
// SliceExpr returns x deep copy.
// Copy of nil argument is nil.
func SliceExpr(x *ast.SliceExpr) *ast.SliceExpr {
@@ -334,21 +346,6 @@ func FieldList(x *ast.FieldList) *ast.FieldList {
return &cp
}
-// FuncType returns x deep copy.
-// Copy of nil argument is nil.
-func FuncType(x *ast.FuncType) *ast.FuncType {
- if x == nil {
- return nil
- }
- cp := *x
- cp.Params = FieldList(x.Params)
- cp.Results = FieldList(x.Results)
- if typeParams := typeparams.ForFuncType(x); typeParams != nil {
- *typeparams.ForFuncType(&cp) = *FieldList(typeParams)
- }
- return &cp
-}
-
// InterfaceType returns x deep copy.
// Copy of nil argument is nil.
func InterfaceType(x *ast.InterfaceType) *ast.InterfaceType {
@@ -423,23 +420,6 @@ func ValueSpec(x *ast.ValueSpec) *ast.ValueSpec {
return &cp
}
-// TypeSpec returns x deep copy.
-// Copy of nil argument is nil.
-func TypeSpec(x *ast.TypeSpec) *ast.TypeSpec {
- if x == nil {
- return nil
- }
- cp := *x
- cp.Name = Ident(x.Name)
- cp.Type = copyExpr(x.Type)
- cp.Doc = CommentGroup(x.Doc)
- cp.Comment = CommentGroup(x.Comment)
- if typeParams := typeparams.ForTypeSpec(x); typeParams != nil {
- *typeparams.ForTypeSpec(&cp) = *FieldList(typeParams)
- }
- return &cp
-}
-
// Spec returns x deep copy.
// Copy of nil argument is nil.
func Spec(x ast.Spec) ast.Spec {
@@ -858,6 +838,8 @@ func copyExpr(x ast.Expr) ast.Expr {
return SelectorExpr(x)
case *ast.IndexExpr:
return IndexExpr(x)
+ case *typeparams.IndexListExpr:
+ return IndexListExpr(x)
case *ast.SliceExpr:
return SliceExpr(x)
case *ast.TypeAssertExpr:
diff --git a/vendor/github.com/go-toolsmith/astcopy/astcopy_go117.go b/vendor/github.com/go-toolsmith/astcopy/astcopy_go117.go
new file mode 100644
index 000000000..1b748bae5
--- /dev/null
+++ b/vendor/github.com/go-toolsmith/astcopy/astcopy_go117.go
@@ -0,0 +1,30 @@
+//go:build !go1.18
+// +build !go1.18
+
+package astcopy
+
+// FuncType returns x deep copy.
+// Copy of nil argument is nil.
+func FuncType(x *ast.FuncType) *ast.FuncType {
+ if x == nil {
+ return nil
+ }
+ cp := *x
+ cp.Params = FieldList(x.Params)
+ cp.Results = FieldList(x.Results)
+ return &cp
+}
+
+// TypeSpec returns x deep copy.
+// Copy of nil argument is nil.
+func TypeSpec(x *ast.TypeSpec) *ast.TypeSpec {
+ if x == nil {
+ return nil
+ }
+ cp := *x
+ cp.Name = Ident(x.Name)
+ cp.Type = copyExpr(x.Type)
+ cp.Doc = CommentGroup(x.Doc)
+ cp.Comment = CommentGroup(x.Comment)
+ return &cp
+}
diff --git a/vendor/github.com/go-toolsmith/astcopy/astcopy_go118.go b/vendor/github.com/go-toolsmith/astcopy/astcopy_go118.go
new file mode 100644
index 000000000..72f800acc
--- /dev/null
+++ b/vendor/github.com/go-toolsmith/astcopy/astcopy_go118.go
@@ -0,0 +1,36 @@
+//go:build go1.18
+// +build go1.18
+
+package astcopy
+
+import (
+ "go/ast"
+)
+
+// FuncType returns x deep copy.
+// Copy of nil argument is nil.
+func FuncType(x *ast.FuncType) *ast.FuncType {
+ if x == nil {
+ return nil
+ }
+ cp := *x
+ cp.Params = FieldList(x.Params)
+ cp.Results = FieldList(x.Results)
+ cp.TypeParams = FieldList(x.TypeParams)
+ return &cp
+}
+
+// TypeSpec returns x deep copy.
+// Copy of nil argument is nil.
+func TypeSpec(x *ast.TypeSpec) *ast.TypeSpec {
+ if x == nil {
+ return nil
+ }
+ cp := *x
+ cp.Name = Ident(x.Name)
+ cp.Type = copyExpr(x.Type)
+ cp.Doc = CommentGroup(x.Doc)
+ cp.Comment = CommentGroup(x.Comment)
+ cp.TypeParams = FieldList(x.TypeParams)
+ return &cp
+}
diff --git a/vendor/github.com/go-toolsmith/astcopy/go.mod b/vendor/github.com/go-toolsmith/astcopy/go.mod
deleted file mode 100644
index 8e34ca50f..000000000
--- a/vendor/github.com/go-toolsmith/astcopy/go.mod
+++ /dev/null
@@ -1,9 +0,0 @@
-module github.com/go-toolsmith/astcopy
-
-go 1.16
-
-require (
- github.com/go-toolsmith/astequal v1.0.2
- github.com/go-toolsmith/strparse v1.0.0
- golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171
-)
diff --git a/vendor/github.com/go-toolsmith/astcopy/go.sum b/vendor/github.com/go-toolsmith/astcopy/go.sum
deleted file mode 100644
index 743006ed1..000000000
--- a/vendor/github.com/go-toolsmith/astcopy/go.sum
+++ /dev/null
@@ -1,6 +0,0 @@
-github.com/go-toolsmith/astequal v1.0.2 h1:+XvaV8zNxua+9+Oa4AHmgmpo4RYAbwr/qjNppLfX2yM=
-github.com/go-toolsmith/astequal v1.0.2/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4=
-github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4=
-github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8=
-golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171 h1:DZhP7zSquENyG3Yb6ZpGqNEtgE8dfXhcLcheIF9RQHY=
-golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=