Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
32cd8875
Commit
32cd8875
authored
Jul 13, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- handle type forward declarations correctly
R=r DELTA=8 (6 added, 0 deleted, 2 changed) OCL=31537 CL=31537
parent
efb918b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
doc.go
src/pkg/go/doc/doc.go
+8
-2
No files found.
src/pkg/go/doc/doc.go
View file @
32cd8875
...
...
@@ -77,8 +77,12 @@ func (doc *DocReader) lookupTypeDoc(typ ast.Expr) *typeDoc {
func
(
doc
*
DocReader
)
addType
(
decl
*
ast
.
GenDecl
)
{
typ
:=
decl
.
Specs
[
0
]
.
(
*
ast
.
TypeSpec
);
name
:=
typ
.
Name
.
Value
;
tdoc
:=
&
typeDoc
{
decl
,
make
(
map
[
string
]
*
ast
.
FuncDecl
),
make
(
map
[
string
]
*
ast
.
FuncDecl
)};
doc
.
types
[
name
]
=
tdoc
;
if
_
,
found
:=
doc
.
types
[
name
];
!
found
{
tdoc
:=
&
typeDoc
{
decl
,
make
(
map
[
string
]
*
ast
.
FuncDecl
),
make
(
map
[
string
]
*
ast
.
FuncDecl
)};
doc
.
types
[
name
]
=
tdoc
;
}
// If the type was found it may have been added as a forward
// declaration before, or this is a forward-declaration.
}
...
...
@@ -90,6 +94,8 @@ func (doc *DocReader) addFunc(fun *ast.FuncDecl) {
if
fun
.
Recv
!=
nil
{
// method
// (all receiver types must be declared before they are used)
// TODO(gri) Reconsider this logic if no forward-declarations
// are required anymore.
typ
=
doc
.
lookupTypeDoc
(
fun
.
Recv
.
Type
);
if
typ
!=
nil
{
// type found (i.e., exported)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment