]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: update mkbuiltin.go and re-enable TestBuiltin
authorMatthew Dempsky <mdempsky@google.com>
Wed, 23 Dec 2020 08:36:34 +0000 (00:36 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 23 Dec 2020 09:51:13 +0000 (09:51 +0000)
Update's mkbuiltin.go to match builtin.go after the recent rf
rewrites.

Change-Id: I80cf5d7c27b36fe28553406819cb4263de84e5ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/279952
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/typecheck/builtin_test.go
src/cmd/compile/internal/typecheck/mkbuiltin.go

index cc8d49730aaea782a3975cfef26e44c4c61230a5..fb9d3e393f10e15755e95508655352534aeab985 100644 (file)
@@ -13,7 +13,6 @@ import (
 )
 
 func TestBuiltin(t *testing.T) {
-       t.Skip("mkbuiltin needs fixing")
        testenv.MustHaveGoRun(t)
        t.Parallel()
 
index 2a208d960f5f4759ee9634664f95160e9372d7be..27dbf1f10e15af52874a0cff18384feb92264298 100644 (file)
@@ -36,6 +36,7 @@ func main() {
        fmt.Fprintln(&b, "package typecheck")
        fmt.Fprintln(&b)
        fmt.Fprintln(&b, `import (`)
+       fmt.Fprintln(&b, `      "cmd/compile/internal/base"`)
        fmt.Fprintln(&b, `      "cmd/compile/internal/ir"`)
        fmt.Fprintln(&b, `      "cmd/compile/internal/types"`)
        fmt.Fprintln(&b, `)`)
@@ -169,7 +170,7 @@ func (i *typeInterner) mktype(t ast.Expr) string {
                }
                return fmt.Sprintf("types.NewChan(%s, %s)", i.subtype(t.Value), dir)
        case *ast.FuncType:
-               return fmt.Sprintf("functype(nil, %s, %s)", i.fields(t.Params, false), i.fields(t.Results, false))
+               return fmt.Sprintf("NewFuncType(nil, %s, %s)", i.fields(t.Params, false), i.fields(t.Results, false))
        case *ast.InterfaceType:
                if len(t.Methods.List) != 0 {
                        log.Fatal("non-empty interfaces unsupported")
@@ -180,7 +181,7 @@ func (i *typeInterner) mktype(t ast.Expr) string {
        case *ast.StarExpr:
                return fmt.Sprintf("types.NewPtr(%s)", i.subtype(t.X))
        case *ast.StructType:
-               return fmt.Sprintf("tostruct(%s)", i.fields(t.Fields, true))
+               return fmt.Sprintf("NewStructType(%s)", i.fields(t.Fields, true))
 
        default:
                log.Fatalf("unhandled type: %#v", t)
@@ -196,13 +197,13 @@ func (i *typeInterner) fields(fl *ast.FieldList, keepNames bool) string {
        for _, f := range fl.List {
                typ := i.subtype(f.Type)
                if len(f.Names) == 0 {
-                       res = append(res, fmt.Sprintf("anonfield(%s)", typ))
+                       res = append(res, fmt.Sprintf("ir.NewField(base.Pos, nil, nil, %s)", typ))
                } else {
                        for _, name := range f.Names {
                                if keepNames {
-                                       res = append(res, fmt.Sprintf("namedfield(%q, %s)", name.Name, typ))
+                                       res = append(res, fmt.Sprintf("ir.NewField(base.Pos, Lookup(%q), nil, %s)", name.Name, typ))
                                } else {
-                                       res = append(res, fmt.Sprintf("anonfield(%s)", typ))
+                                       res = append(res, fmt.Sprintf("ir.NewField(base.Pos, nil, nil, %s)", typ))
                                }
                        }
                }