MCPcopy Create free account
hub / github.com/dop251/goja / sourceOffset

Method sourceOffset

compiler.go:460–469  ·  view source on GitHub ↗
(pc int)

Source from the content-addressed store, hash-verified

458}
459
460func (p *Program) sourceOffset(pc int) int {
461 i := sort.Search(len(p.srcMap), func(idx int) bool {
462 return p.srcMap[idx].pc > pc
463 }) - 1
464 if i >= 0 {
465 return p.srcMap[i].srcPos
466 }
467
468 return 0
469}
470
471func (p *Program) addSrcMap(srcPos int) {
472 if len(p.srcMap) > 0 && p.srcMap[len(p.srcMap)-1].srcPos == srcPos {

Callers 4

TestSrcLocationFunction · 0.80
PositionMethod · 0.80
profileMethod · 0.80
finaliseVarAllocMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestSrcLocationFunction · 0.64