mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/syntax: track column position at function end
Fixes #19576. Change-Id: I11034fb08e989f6eb7d54bde873b92804223598d Reviewed-on: https://go-review.googlesource.com/38291 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
c8f38b3398
commit
f37ee0f33b
3 changed files with 31 additions and 33 deletions
|
|
@ -325,7 +325,7 @@ func (p *noder) funcDecl(fun *syntax.FuncDecl) *Node {
|
|||
yyerror("go:nosplit and go:systemstack cannot be combined")
|
||||
}
|
||||
f.Func.Pragma = pragma
|
||||
lineno = makePos(fun.Pos().Base(), fun.EndLine, 0)
|
||||
lineno = Ctxt.PosTable.XPos(fun.Rbrace)
|
||||
f.Func.Endlineno = lineno
|
||||
|
||||
funcbody(f)
|
||||
|
|
@ -451,14 +451,14 @@ func (p *noder) expr(expr syntax.Expr) *Node {
|
|||
l[i] = p.wrapname(expr.ElemList[i], e)
|
||||
}
|
||||
n.List.Set(l)
|
||||
lineno = makePos(expr.Pos().Base(), expr.EndLine, 0)
|
||||
lineno = Ctxt.PosTable.XPos(expr.Rbrace)
|
||||
return n
|
||||
case *syntax.KeyValueExpr:
|
||||
return p.nod(expr, OKEY, p.expr(expr.Key), p.wrapname(expr.Value, p.expr(expr.Value)))
|
||||
case *syntax.FuncLit:
|
||||
closurehdr(p.typeExpr(expr.Type))
|
||||
body := p.stmts(expr.Body)
|
||||
lineno = makePos(expr.Pos().Base(), expr.EndLine, 0)
|
||||
lineno = Ctxt.PosTable.XPos(expr.Rbrace)
|
||||
return p.setlineno(expr, closurebody(body))
|
||||
case *syntax.ParenExpr:
|
||||
return p.nod(expr, OPAREN, p.expr(expr.X), nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue