sourcemap

package
v0.3.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package sourcemap records backend-independent relationships between generated code and TypeRB source. Target-specific source-map encodings are deliberately layered on top of this model.

Index

Constants

View Source
const Version = 1

Variables

This section is empty.

Functions

func EndMarker

func EndMarker(id int) string

func IsMarkerLine

func IsMarkerLine(line string) bool

func PositionAt

func PositionAt(source string, offset int) token.Position

func StartMarker

func StartMarker(id int) string

func WithGoLineDirectives added in v0.2.9

func WithGoLineDirectives(output, generatedPath string, mapping Map) string

WithGoLineDirectives projects the shared map into Go's compiler-recognized line directives. Delve then sees TypeRB source paths without needing a TypeRB-specific breakpoint or stack-frame translation layer.

Types

type Generated

type Generated struct {
	Output string
	Map    Map
}

type Location

type Location struct {
	Path string
	Span token.Span
}

type Map

type Map struct {
	Version  int
	Mappings []Mapping
}

func ExtractMarkers

func ExtractMarkers(marked string, locations map[int]Location) (string, Map)

ExtractMarkers removes codegen-only marker lines after target formatting and converts their byte ranges into the shared mapping model.

func (Map) SourceAt

func (m Map) SourceAt(generated token.Position) (Location, bool)

type Mapping

type Mapping struct {
	Generated token.Span
	Source    Location
}

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}

func NewRecorder

func NewRecorder(path string) *Recorder

func (*Recorder) Build

func (r *Recorder) Build(output string) Map

func (*Recorder) Record

func (r *Recorder) Record(start, end int, source token.Span)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL