mirror of
https://github.com/golang/go
synced 2024-11-22 13:45:00 -07:00
if the typestring gives a field name of "?", drop it.
R=rsc DELTA=11 (7 added, 0 deleted, 4 changed) OCL=20988 CL=20988
This commit is contained in:
parent
ac09eb4f49
commit
546f269c3b
@ -118,7 +118,7 @@ export func TestAll(tt *testing.T) { // TODO(r): wrap up better
|
||||
typedump("*chan<-string", "*chan<-string");
|
||||
typedump("struct {c *chan *int32; d float32}", "struct{c *chan*int32; d float32}");
|
||||
typedump("*(a int8, b int32)", "*(a int8, b int32)");
|
||||
typedump("struct {c *(? *chan *P.integer, ? *int8)}", "struct{c *(? *chan*P.integer, ? *int8)}");
|
||||
typedump("struct {c *(? *chan *P.integer, ? *int8)}", "struct{c *(*chan*P.integer, *int8)}");
|
||||
typedump("struct {a int8; b int32}", "struct{a int8; b int32}");
|
||||
typedump("struct {a int8; b int8; b int32}", "struct{a int8; b int8; b int32}");
|
||||
typedump("struct {a int8; b int8; c int8; b int32}", "struct{a int8; b int8; c int8; b int32}");
|
||||
@ -149,7 +149,7 @@ export func TestAll(tt *testing.T) { // TODO(r): wrap up better
|
||||
valuedump("*chan<-string", "*chan<-string(0)");
|
||||
valuedump("struct {c *chan *int32; d float32}", "struct{c *chan*int32; d float32}{*chan*int32(0), 0}");
|
||||
valuedump("*(a int8, b int32)", "*(a int8, b int32)(0)");
|
||||
valuedump("struct {c *(? *chan *P.integer, ? *int8)}", "struct{c *(? *chan*P.integer, ? *int8)}{*(? *chan*P.integer, ? *int8)(0)}");
|
||||
valuedump("struct {c *(? *chan *P.integer, ? *int8)}", "struct{c *(*chan*P.integer, *int8)}{*(*chan*P.integer, *int8)(0)}");
|
||||
valuedump("struct {a int8; b int32}", "struct{a int8; b int32}{0, 0}");
|
||||
valuedump("struct {a int8; b int8; b int32}", "struct{a int8; b int8; b int32}{0, 0, 0}");
|
||||
|
||||
|
@ -47,7 +47,10 @@ func TypeFieldsToString(t HasFields, sep string) string {
|
||||
var str string;
|
||||
for i := 0; i < t.Len(); i++ {
|
||||
str1, typ, tag, offset := t.Field(i);
|
||||
str1 += " " + TypeToString(typ, false);
|
||||
if str1 != "" {
|
||||
str1 += " "
|
||||
}
|
||||
str1 += TypeToString(typ, false);
|
||||
if tag != "" {
|
||||
str1 += " " + DoubleQuote(tag);
|
||||
}
|
||||
|
@ -690,7 +690,11 @@ func (p *Parser) Fields(sep, term string) *[]Field {
|
||||
}
|
||||
a = a1;
|
||||
}
|
||||
a[nf].name = p.token;
|
||||
name := p.token;
|
||||
if name == "?" { // used to represent a missing name
|
||||
name = ""
|
||||
}
|
||||
a[nf].name = name;
|
||||
p.Next();
|
||||
a[nf].typ = p.Type("");
|
||||
if p.token != "" && p.token[0] == '"' {
|
||||
|
Loading…
Reference in New Issue
Block a user