Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gopbuiltingen: hide builtin newRange #2127

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions builtin/doc/builtin.gop
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package builtin

import (
"gop/builtin"
"gop/builtin/iox"
"io"
"os"
Expand All @@ -17,7 +16,6 @@ func Blines(r io.Reader) iox.BLineReader
// Type returns the reflection [Type] that represents the dynamic type of i.
// If i is a nil interface value, Type returns nil.
func Type(i any) reflect.Type
func NewRange(start, end, step int) *builtin.IntRange

// Print formats using the default formats for its operands and writes to standard output.
// Spaces are added between operands when neither is a string.
Expand Down
11 changes: 6 additions & 5 deletions cmd/chore/gopbuiltingen/builtingen.gox
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func gen() []byte {
f.Decls <- &ast.GenDecl{
Tok: token.IMPORT,
Specs: []ast.Spec{
importSpec("gop/builtin"),
importSpec("gop/builtin/iox"),
importSpec("io"),
importSpec("os"),
Expand Down Expand Up @@ -105,10 +104,12 @@ func initBuiltin(fn gopq.NodeSet) {
item := stmt.callExpr("scope.Insert").arg(0).cache
for call <- item.callExpr("gogen.NewOverloadFunc") {
built := call.arg(2).unquotedString!
ref := call.arg(3).callExpr.one
pkg := ref.fun.x.ident!
name := ref.arg(0).unquotedString!
Builtins <- builtin{built, {pkg, name, 0}}
if built != "newRange" { // hide builtin `newRange`
ref := call.arg(3).callExpr.one
pkg := ref.fun.x.ident!
name := ref.arg(0).unquotedString!
Builtins <- builtin{built, {pkg, name, 0}}
}
}
for call <- stmt.callExpr("initBuiltinFns") {
pkg := call.arg(2).ident!
Expand Down
3 changes: 0 additions & 3 deletions cmd/chore/gopbuiltingen/helper.gop
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ func toParams(params *ast.FieldList, at string) *ast.FieldList {
if params == nil {
return nil
}
if at == "buil" {
at = "builtin"
}
list := make([]*ast.Field, len(params.List))
for i, p <- params.List {
typ := p.Type
Expand Down
Loading