github.com/Rookout/GoSDK@v0.1.48/pkg/services/assembler/internal/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.assembler file.
     4  
     5  package obj
     6  
     7  import (
     8  	"github.com/Rookout/GoSDK/pkg/services/assembler/internal/goobj"
     9  	"github.com/Rookout/GoSDK/pkg/services/assembler/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  
    18  
    19  
    20  func (ctxt *Link) getFileSymbolAndLine(xpos src.XPos) (f string, l int32) {
    21  	pos := ctxt.InnermostPos(xpos)
    22  	if !pos.IsKnown() {
    23  		pos = src.Pos{}
    24  	}
    25  	return pos.SymFilename(), int32(pos.RelLine())
    26  }
    27  
    28  
    29  
    30  
    31  
    32  func (ctxt *Link) getFileIndexAndLine(xpos src.XPos) (int, int32) {
    33  	f, l := ctxt.getFileSymbolAndLine(xpos)
    34  	return ctxt.PosTable.FileIndex(f), l
    35  }