diff options
| author | Matthew Dempsky <mdempsky@google.com> | 2016-08-16 13:33:29 -0700 |
|---|---|---|
| committer | Matthew Dempsky <mdempsky@google.com> | 2016-08-19 01:09:52 +0000 |
| commit | 117793624b630b0ee63abb16dcb019301adc6472 (patch) | |
| tree | de7abfdde47e7fe0307b26d5ad6164ad5136a52e /src/cmd/compile/internal/syntax/parser.go | |
| parent | 4e8c11379345f08ccf47239f7e0ea192917f602a (diff) | |
| download | go-117793624b630b0ee63abb16dcb019301adc6472.tar.xz | |
cmd/compile/internal/syntax: expose additional information for gc
gc needs access to line offsets for Nodes. It also needs access to the
end line offset for function bodies so it knows what line number to
use for things like implicit returns and defer executions.
Lastly, include an extra bool to distinguish between simple and full
slice expressions. This is redundant in valid parse trees, but needed
by gc for producing complete warnings in invalid inputs.
Change-Id: I64baf334a35c72336d26fa6755c67eb9d6f4e93c
Reviewed-on: https://go-review.googlesource.com/27196
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/syntax/parser.go')
| -rw-r--r-- | src/cmd/compile/internal/syntax/parser.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/syntax/parser.go b/src/cmd/compile/internal/syntax/parser.go index f267d4b2c9..40253224f0 100644 --- a/src/cmd/compile/internal/syntax/parser.go +++ b/src/cmd/compile/internal/syntax/parser.go @@ -422,6 +422,8 @@ func (p *parser) funcDecl() *FuncDecl { f.Type = p.funcType() f.Body = p.funcBody() + f.EndLine = uint32(p.line) + // TODO(gri) deal with function properties // if noescape && body != nil { // p.error("can only use //go:noescape with external func implementations") @@ -624,6 +626,7 @@ func (p *parser) operand(keep_parens bool) Expr { f.init(p) f.Type = t f.Body = p.funcBody() + f.EndLine = uint32(p.line) p.xnest-- p.fnest-- return f @@ -739,6 +742,7 @@ loop: t.Index[1] = p.expr() } if p.got(_Colon) { + t.Full = true // x[i:j:...] if t.Index[1] == nil { p.error("middle index required in 3-index slice") |
