mirror of
https://github.com/golang/go
synced 2024-11-18 11:04:42 -07:00
go/ssa: change import path of synthetic test package to "test$main"
...to avoid namespace conflicts. Also make its name "main", since it defines func main(). And fix 2 typos. Change-Id: I7cf7894d6bed134907b3d2742255e5a82426071b Reviewed-on: https://go-review.googlesource.com/3150 Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
4d45c85020
commit
e079f6c632
@ -40,13 +40,13 @@ func TestCallgraph(t *testing.T) {
|
|||||||
// tests: main is not called.
|
// tests: main is not called.
|
||||||
{"rta", format, true, []string{
|
{"rta", format, true, []string{
|
||||||
`pkg.Example --> (pkg.C).f`,
|
`pkg.Example --> (pkg.C).f`,
|
||||||
`testmain.init --> pkg.init`,
|
`test$main.init --> pkg.init`,
|
||||||
}},
|
}},
|
||||||
{"pta", format, true, []string{
|
{"pta", format, true, []string{
|
||||||
`<root> --> pkg.Example`,
|
`<root> --> pkg.Example`,
|
||||||
`<root> --> testmain.init`,
|
`<root> --> test$main.init`,
|
||||||
`pkg.Example --> (pkg.C).f`,
|
`pkg.Example --> (pkg.C).f`,
|
||||||
`testmain.init --> pkg.init`,
|
`test$main.init --> pkg.init`,
|
||||||
}},
|
}},
|
||||||
} {
|
} {
|
||||||
stdout = new(bytes.Buffer)
|
stdout = new(bytes.Buffer)
|
||||||
|
@ -426,7 +426,7 @@ func (f *Function) lookup(obj types.Object, escaping bool) Value {
|
|||||||
// Definition must be in an enclosing function;
|
// Definition must be in an enclosing function;
|
||||||
// plumb it through intervening closures.
|
// plumb it through intervening closures.
|
||||||
if f.parent == nil {
|
if f.parent == nil {
|
||||||
panic("no Value for type.Object " + obj.Name())
|
panic("no ssa.Value for " + obj.String())
|
||||||
}
|
}
|
||||||
outer := f.parent.lookup(obj, true) // escaping
|
outer := f.parent.lookup(obj, true) // escaping
|
||||||
v := &FreeVar{
|
v := &FreeVar{
|
||||||
|
@ -100,7 +100,7 @@ func (prog *Program) CreateTestMainPackage(pkgs ...*Package) *Package {
|
|||||||
Prog: prog,
|
Prog: prog,
|
||||||
Members: make(map[string]Member),
|
Members: make(map[string]Member),
|
||||||
values: make(map[types.Object]Value),
|
values: make(map[types.Object]Value),
|
||||||
Object: types.NewPackage("testmain", "testmain"),
|
Object: types.NewPackage("test$main", "main"),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build package's init function.
|
// Build package's init function.
|
||||||
|
@ -51,7 +51,7 @@ func (g Graph) Search(roots ...string) map[string]bool {
|
|||||||
return seen
|
return seen
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builds scans the specified Go workspace and builds the forward and
|
// Build scans the specified Go workspace and builds the forward and
|
||||||
// reverse import dependency graphs for all its packages.
|
// reverse import dependency graphs for all its packages.
|
||||||
// It also returns a mapping from import paths to errors for packages
|
// It also returns a mapping from import paths to errors for packages
|
||||||
// that could not be loaded.
|
// that could not be loaded.
|
||||||
|
Loading…
Reference in New Issue
Block a user