mirror of
https://github.com/golang/go
synced 2024-11-11 20:50:23 -07:00
[dev.regabi] cmd/compile: refactor type initialization code into helper
Create a helper routine for initializing the types package, so as make it easier to use in unit testing (in a follow-on patch). Change-Id: I0f937788dfd34ac6641a4f28c16e47008aa08116 Reviewed-on: https://go-review.googlesource.com/c/go/+/273010 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Than McIntosh <thanm@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
9c5241e520
commit
2b76429eb0
@ -210,13 +210,7 @@ func Main(archInit func(*Arch)) {
|
|||||||
// initialize types package
|
// initialize types package
|
||||||
// (we need to do this to break dependencies that otherwise
|
// (we need to do this to break dependencies that otherwise
|
||||||
// would lead to import cycles)
|
// would lead to import cycles)
|
||||||
types.Widthptr = Widthptr
|
initializeTypesPackage()
|
||||||
types.Dowidth = dowidth
|
|
||||||
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
|
||||||
return typenamesym(t).Linksym()
|
|
||||||
}
|
|
||||||
|
|
||||||
initUniverse()
|
|
||||||
|
|
||||||
dclcontext = ir.PEXTERN
|
dclcontext = ir.PEXTERN
|
||||||
|
|
||||||
@ -1125,3 +1119,13 @@ func parseLang(s string) (lang, error) {
|
|||||||
}
|
}
|
||||||
return lang{major: major, minor: minor}, nil
|
return lang{major: major, minor: minor}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func initializeTypesPackage() {
|
||||||
|
types.Widthptr = Widthptr
|
||||||
|
types.Dowidth = dowidth
|
||||||
|
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
||||||
|
return typenamesym(t).Linksym()
|
||||||
|
}
|
||||||
|
|
||||||
|
initUniverse()
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user