Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
dba96cf4
Commit
dba96cf4
authored
Mar 30, 2011
by
Roger Peppe
Committed by
Robert Griesemer
Mar 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/parser: fix scoping for local type declarations
R=gri CC=golang-dev
https://golang.org/cl/4332045
parent
6b567d26
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
src/pkg/go/parser/parser.go
src/pkg/go/parser/parser.go
+4
-3
No files found.
src/pkg/go/parser/parser.go
View file @
dba96cf4
...
...
@@ -2016,16 +2016,17 @@ func parseTypeSpec(p *parser, doc *ast.CommentGroup, _ int) ast.Spec {
}
ident
:=
p
.
parseIdent
()
typ
:=
p
.
parseType
()
p
.
expectSemi
()
// call before accessing p.linecomment
// Go spec: The scope of a type identifier declared inside a function begins
// at the identifier in the TypeSpec and ends at the end of the innermost
// containing block.
// (Global identifiers are resolved in a separate phase after parsing.)
spec
:=
&
ast
.
TypeSpec
{
doc
,
ident
,
typ
,
p
.
lineComment
}
spec
:=
&
ast
.
TypeSpec
{
doc
,
ident
,
nil
,
p
.
lineComment
}
p
.
declare
(
spec
,
p
.
topScope
,
ast
.
Typ
,
ident
)
spec
.
Type
=
p
.
parseType
()
p
.
expectSemi
()
// call before accessing p.linecomment
return
spec
}
...
...
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