mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
go AST: First step towards augmenting AST with full type information.
- change ast.Ident back to contain the name and adjust all dependent code - identifier object information will be added again through an optional typechecker phase (in the works). - remove tracking of scopes in parser - it's easier to do this in a separate phase (in the works) - in godoc, generate popup info table directly instead of through a formatter for simpler data flow (at the expense of a little bit more code) Runs all tests. As a result of this change, the currently shown popup information (const, var, type, func, followed by identifier name) will not be shown anymore temporarily. R=rsc CC=golang-dev https://golang.org/cl/1994041
This commit is contained in:
parent
be97fa4c79
commit
1f9dfa294f
25 changed files with 283 additions and 406 deletions
|
|
@ -145,7 +145,7 @@ func (p *Package) guessKinds(f *File) []*Name {
|
|||
if _, err := strconv.Atoi(n.Define); err == nil {
|
||||
ok = true
|
||||
} else if n.Define[0] == '"' || n.Define[0] == '\'' {
|
||||
_, err := parser.ParseExpr("", n.Define, nil)
|
||||
_, err := parser.ParseExpr("", n.Define)
|
||||
if err == nil {
|
||||
ok = true
|
||||
}
|
||||
|
|
@ -801,7 +801,7 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
|
|||
t.Go = name // publish before recursive calls
|
||||
switch dt.Kind {
|
||||
case "union", "class":
|
||||
c.typedef[name.Name()] = c.Opaque(t.Size)
|
||||
c.typedef[name.Name] = c.Opaque(t.Size)
|
||||
if t.C == "" {
|
||||
t.C = fmt.Sprintf("typeof(unsigned char[%d])", t.Size)
|
||||
}
|
||||
|
|
@ -811,7 +811,7 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
|
|||
t.C = csyntax
|
||||
}
|
||||
t.Align = align
|
||||
c.typedef[name.Name()] = g
|
||||
c.typedef[name.Name] = g
|
||||
}
|
||||
|
||||
case *dwarf.TypedefType:
|
||||
|
|
@ -830,8 +830,8 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
|
|||
sub := c.Type(dt.Type)
|
||||
t.Size = sub.Size
|
||||
t.Align = sub.Align
|
||||
if _, ok := c.typedef[name.Name()]; !ok {
|
||||
c.typedef[name.Name()] = sub.Go
|
||||
if _, ok := c.typedef[name.Name]; !ok {
|
||||
c.typedef[name.Name] = sub.Go
|
||||
}
|
||||
|
||||
case *dwarf.UcharType:
|
||||
|
|
@ -875,7 +875,7 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
|
|||
}
|
||||
s = strings.Join(strings.Split(s, " ", -1), "") // strip spaces
|
||||
name := c.Ident("_Ctype_" + s)
|
||||
c.typedef[name.Name()] = t.Go
|
||||
c.typedef[name.Name] = t.Go
|
||||
t.Go = name
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue