mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile/internal/types2: review of hilbert_test.go
Primary differences:
1) syntax package is used instead of the go/* packages
2) parseSrc is a helper function that is used
in place of parser.parseFile.
3) defaultImporter is a helper function providing
access to an importer.
f=hilbert_test.go; diff $f ../../../../go/types/$f
5c5
< package types2_test
---
> package types_test
9d8
< "cmd/compile/internal/syntax"
11a11,14
> "go/ast"
> "go/importer"
> "go/parser"
> "go/token"
15c18
< . "cmd/compile/internal/types2"
---
> . "go/types"
32,33c35,36
< // TODO(gri) get rid of []bytes to string conversion below
< f, err := parseSrc("hilbert.go", string(src))
---
> fset := token.NewFileSet()
> f, err := parser.ParseFile(fset, "hilbert.go", src, 0)
40,41c43,44
< conf := Config{Importer: defaultImporter()}
< _, err = conf.Check(f.PkgName.Value, []*syntax.File{f}, nil)
---
> conf := Config{Importer: importer.Default()}
> _, err = conf.Check(f.Name.Name, fset, []*ast.File{f}, nil)
Change-Id: I65851725a3b6ac35b87177f90b788c469a54a986
Reviewed-on: https://go-review.googlesource.com/c/go/+/265679
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
6e98406ac3
commit
abb31c2558
1 changed files with 0 additions and 1 deletions
|
|
@ -1,4 +1,3 @@
|
|||
// UNREVIEWED
|
||||
// Copyright 2013 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue