cmd/compile: introduce linestr helper to simplify line reporting
Change-Id: Ic9ca792b55cc4ebd0ac6cfa2fbdb58030893bacd
Reviewed-on: https://go-review.googlesource.com/20132
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go
index e5c65c7..e5d72ce 100644
--- a/src/cmd/compile/internal/gc/ssa.go
+++ b/src/cmd/compile/internal/gc/ssa.go
@@ -596,7 +596,7 @@
if !lab.defined() {
lab.defNode = n
} else {
- s.Error("label %v already defined at %v", sym, Ctxt.Line(int(lab.defNode.Lineno)))
+ s.Error("label %v already defined at %v", sym, linestr(lab.defNode.Lineno))
lab.reported = true
}
// The label might already have a target block via a goto.
@@ -3446,9 +3446,9 @@
lno := from.Left.Lineno
if block != nil {
- yyerrorl(lno, "goto %v jumps into block starting at %v", from.Left.Sym, Ctxt.Line(int(block.Lastlineno)))
+ yyerrorl(lno, "goto %v jumps into block starting at %v", from.Left.Sym, linestr(block.Lastlineno))
} else {
- yyerrorl(lno, "goto %v jumps over declaration of %v at %v", from.Left.Sym, dcl, Ctxt.Line(int(dcl.Lastlineno)))
+ yyerrorl(lno, "goto %v jumps over declaration of %v at %v", from.Left.Sym, dcl, linestr(dcl.Lastlineno))
}
}
}
@@ -5181,7 +5181,7 @@
}
func (e *ssaExport) Line(line int32) string {
- return Ctxt.Line(int(line))
+ return linestr(line)
}
// Log logs a message from the compiler.