aboutsummaryrefslogtreecommitdiff
path: root/src/go/parser/parser.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2016-12-16 15:10:07 -0800
committerRobert Griesemer <gri@golang.org>2017-01-09 23:43:12 +0000
commit2e5116bd999be18691d860e47cb87f1446cf70fe (patch)
tree703c3c3509eb5e3faed975015ee00290e6e031b8 /src/go/parser/parser.go
parentffedff7e506cdf298f06ad36f3264ca197aa7d25 (diff)
downloadgo-2e5116bd999be18691d860e47cb87f1446cf70fe.tar.gz
go-2e5116bd999be18691d860e47cb87f1446cf70fe.zip
[dev.typealias] go/ast, go/parser, go/printer, go/types: initial type alias support
Parsing and printing support for type aliases complete. go/types recognizes them an issues an "unimplemented" error for now. For #18130. Change-Id: I9f2f7b1971b527276b698d9347bcd094ef0012ee Reviewed-on: https://go-review.googlesource.com/34986 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/go/parser/parser.go')
-rw-r--r--src/go/parser/parser.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/go/parser/parser.go b/src/go/parser/parser.go
index d3ef7db31e..40c4a3e58d 100644
--- a/src/go/parser/parser.go
+++ b/src/go/parser/parser.go
@@ -2327,7 +2327,10 @@ func (p *parser) parseTypeSpec(doc *ast.CommentGroup, _ token.Token, _ int) ast.
// (Global identifiers are resolved in a separate phase after parsing.)
spec := &ast.TypeSpec{Doc: doc, Name: ident}
p.declare(spec, nil, p.topScope, ast.Typ, ident)
-
+ if p.tok == token.ASSIGN {
+ spec.Assign = p.pos
+ p.next()
+ }
spec.Type = p.parseType()
p.expectSemi() // call before accessing p.linecomment
spec.Comment = p.lineComment