mirror of https://github.com/golang/go.git
cmd/compile/internal/gc: support invalid types/constants in binary export data
(Corresponding x/tools/go/gcimporter change is https://go-review.googlesource.com/#/c/20827/) Change-Id: I64e7fee2e273d387f1c51b87986294489978d250 Reviewed-on: https://go-review.googlesource.com/20828 Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
2d4c3d2489
commit
a5cd53a9fd
|
|
@ -1190,6 +1190,7 @@ const (
|
|||
complexTag
|
||||
stringTag
|
||||
nilTag
|
||||
unknownTag // not used by gc (only appears in packages with errors)
|
||||
)
|
||||
|
||||
// Debugging support.
|
||||
|
|
@ -1218,6 +1219,8 @@ var tagString = [...]string{
|
|||
-fractionTag: "fraction",
|
||||
-complexTag: "complex",
|
||||
-stringTag: "string",
|
||||
-nilTag: "nil",
|
||||
-unknownTag: "unknown",
|
||||
}
|
||||
|
||||
// untype returns the "pseudo" untyped type for a Ctype (import/export use only).
|
||||
|
|
@ -1289,6 +1292,9 @@ func predeclared() []*Type {
|
|||
// package unsafe
|
||||
Types[TUNSAFEPTR],
|
||||
|
||||
// invalid type (package contains errors)
|
||||
Types[Txxx],
|
||||
|
||||
// any type, for builtin export data
|
||||
Types[TANY],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -509,6 +509,9 @@ func (p *importer) value(typ *Type) (x Val) {
|
|||
case stringTag:
|
||||
x.U = p.string()
|
||||
|
||||
case unknownTag:
|
||||
Fatalf("importer: unknown constant (importing package with errors)")
|
||||
|
||||
case nilTag:
|
||||
x.U = new(NilVal)
|
||||
|
||||
|
|
|
|||
|
|
@ -681,7 +681,10 @@ var predeclared = []types.Type{
|
|||
// package unsafe
|
||||
types.Typ[types.UnsafePointer],
|
||||
|
||||
// any type, for builtin export data
|
||||
// invalid type
|
||||
types.Typ[types.Invalid], // only appears in packages with errors
|
||||
|
||||
// TODO(mdempsky): Provide an actual Type value to represent "any"?
|
||||
// (Why exactly does gc emit the "any" type?)
|
||||
types.Typ[types.Invalid],
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue