pkg: exclude some builtins from generation
- strings.ToValidUTF8: not compatible with go1.12
- math/bits.RotateLeft: makes no sense in CUE
Change-Id: Ia8e183f4e4ae366d977f80d2ef0c461b516d75b6
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/3787
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/builtins.go b/cue/builtins.go
index 80eec8a..c239e26 100644
--- a/cue/builtins.go
+++ b/cue/builtins.go
@@ -1673,16 +1673,6 @@
}()
},
}, {
- Name: "RotateLeft",
- Params: []kind{intKind, intKind},
- Result: intKind,
- Func: func(c *callCtxt) {
- x, k := c.uint64(0), c.int(1)
- c.ret = func() interface{} {
- return bits.RotateLeft64(x, k)
- }()
- },
- }, {
Name: "Reverse",
Params: []kind{intKind},
Result: intKind,
diff --git a/pkg/math/bits/manual.go b/pkg/math/bits/manual.go
index f7376a6..64ea5bb 100644
--- a/pkg/math/bits/manual.go
+++ b/pkg/math/bits/manual.go
@@ -107,12 +107,6 @@
return bits.OnesCount64(x)
}
-// RotateLeft returns the value of x rotated left by (k mod UintSize) bits.
-// To rotate x right by k bits, call RotateLeft(x, -k).
-func RotateLeft(x uint64, k int) uint64 {
- return bits.RotateLeft64(x, k)
-}
-
// Reverse returns the value of x with its bits in reversed order.
func Reverse(x uint64) uint64 {
return bits.Reverse64(x)
diff --git a/pkg/strings/strings.go b/pkg/strings/strings.go
index 73df2a1..a2077fb 100644
--- a/pkg/strings/strings.go
+++ b/pkg/strings/strings.go
@@ -16,7 +16,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate qgo -exclude=Rune$,Func$,^Map$,Special$,EqualFold,Byte,Title$,All$ extract strings
+//go:generate qgo -exclude=Rune$,Func$,^Map$,Special$,EqualFold,Byte,Title$,ToValidUTF8,All$ extract strings
package strings
@@ -163,12 +163,6 @@
return strings.ToLower(s)
}
-// ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences
-// replaced by the replacement string, which may be empty.
-func ToValidUTF8(s, replacement string) string {
- return strings.ToValidUTF8(s, replacement)
-}
-
// Trim returns a slice of the string s with all leading and
// trailing Unicode code points contained in cutset removed.
func Trim(s string, cutset string) string {