Documentation
¶
Index ¶
- type Mapping
- type SourceMap
- type SourceMapper
- func (m *SourceMapper) AddMapping(sourceLine, sourceColumn int)
- func (m *SourceMapper) AddNamedMapping(sourceLine, sourceColumn int, name string)
- func (m *SourceMapper) AdvanceColumn(n int)
- func (m *SourceMapper) AdvanceLine()
- func (m *SourceMapper) AdvanceString(s string)
- func (m *SourceMapper) SourceMap() *SourceMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mapping ¶
type Mapping struct {
// Generated position (in output)
GeneratedLine int
GeneratedColumn int
// Original position (in source)
SourceLine int
SourceColumn int
// Optional: index into the names array
NameIndex int
HasName bool
}
Mapping represents a single source map mapping entry. It connects a position in the generated code to a position in the original source.
type SourceMap ¶
type SourceMap struct {
Version int `json:"version"`
File string `json:"file,omitempty"`
SourceRoot string `json:"sourceRoot,omitempty"`
Sources []string `json:"sources"`
SourcesContent []string `json:"sourcesContent,omitempty"`
Names []string `json:"names,omitempty"`
Mappings string `json:"mappings"`
}
SourceMap represents a Source Map v3 structure.
type SourceMapper ¶
type SourceMapper struct {
// contains filtered or unexported fields
}
SourceMapper accumulates mappings during code generation. It tracks the current position in the generated output and allows adding mappings back to the original source positions.
func (*SourceMapper) AddMapping ¶
func (m *SourceMapper) AddMapping(sourceLine, sourceColumn int)
AddMapping records a mapping from the current generated position to the given original source position (0-based line and column from token).
func (*SourceMapper) AddNamedMapping ¶
func (m *SourceMapper) AddNamedMapping(sourceLine, sourceColumn int, name string)
AddNamedMapping records a mapping with an associated name (for identifiers).
func (*SourceMapper) AdvanceColumn ¶
func (m *SourceMapper) AdvanceColumn(n int)
AdvanceColumn advances the generated column position by n characters.
func (*SourceMapper) AdvanceLine ¶
func (m *SourceMapper) AdvanceLine()
NewLine advances to the next line in the generated output.
func (*SourceMapper) AdvanceString ¶
func (m *SourceMapper) AdvanceString(s string)
AdvanceString advances the position based on the content of a string, handling newlines appropriately.
func (*SourceMapper) SourceMap ¶
func (m *SourceMapper) SourceMap() *SourceMap
SourceMap produces the final SourceMap structure.