1
2
3
4
5 package obj
6
7 import (
8 "cmd/internal/goobj"
9 "cmd/internal/src"
10 )
11
12
13 func (ctxt *Link) AddImport(pkg string, fingerprint goobj.FingerprintType) {
14 ctxt.Imports = append(ctxt.Imports, goobj.ImportedPkg{Pkg: pkg, Fingerprint: fingerprint})
15 }
16
17 func linkgetlineFromPos(ctxt *Link, xpos src.XPos) (f string, l int32) {
18 pos := ctxt.PosTable.Pos(xpos)
19 if !pos.IsKnown() {
20 pos = src.Pos{}
21 }
22
23 return pos.SymFilename(), int32(pos.RelLine())
24 }
25
26
27 func getFileIndexAndLine(ctxt *Link, xpos src.XPos) (int, int32) {
28 f, l := linkgetlineFromPos(ctxt, xpos)
29 return ctxt.PosTable.FileIndex(f), l
30 }
31
View as plain text