github.com/golangaccount/cmd.internal@v0.0.0-20191108101845-8306c88f1d22/obj/line.go (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package obj
     6  
     7  import (
     8  	"github.com/golangaccount/cmd.internal/src"
     9  )
    10  
    11  // AddImport adds a package to the list of imported packages.
    12  func (ctxt *Link) AddImport(pkg string) {
    13  	ctxt.Imports = append(ctxt.Imports, pkg)
    14  }
    15  
    16  func linkgetlineFromPos(ctxt *Link, xpos src.XPos) (f string, l int32) {
    17  	pos := ctxt.PosTable.Pos(xpos)
    18  	if !pos.IsKnown() {
    19  		pos = src.Pos{}
    20  	}
    21  	// TODO(gri) Should this use relative or absolute line number?
    22  	return pos.SymFilename(), int32(pos.RelLine())
    23  }