UnpackedSourceMap
A source map that supports efficient mapping queries.
This bundles together a SourceMap
and a cache of its unpacked mapping segments.
Topics
Initializers
init(SourceMap)
init(SourceMap)
Unpack a new source map and cache the segments.
Declaration
public init(_ sourceMap: SourceMap) throws
Methods
func map(line: Int, column: Int, invalidSourcePos: SourceMap.SourcePos?) -> SourceMap.Segment?
func map(line: Int, column: Int, invalidSourcePos: SourceMap.SourcePos?) -> SourceMap.Segment?
Map a location in the generated code to its source.
All name
indices are guaranteed valid at time of call: any out of range are replaced with
nil
before being returned. All source
indices are either valid at time of call or as
requested via the invalidSourcePos
parameter.
Declaration
public func map(
line: Int, column: Int, invalidSourcePos: SourceMap.SourcePos? = nil
) -> SourceMap.Segment?
Parameters
line |
0-based index of the line in the generated code file. |
column |
0-based index of the column in |
invalidSourcePos |
Value to substitute for any decoded |
Return Value
The mapping segment, or nil
if there is no mapping for the row.
Properties
var segments: [[SourceMap.Segment]]
var segments: [[SourceMap.Segment]]
The expanded mapping data from sourceMap
Declaration
public let segments: [[SourceMap.Segment]]
var segmentsDescription: String
var segmentsDescription: String
A formatted multi-line string describing the mapping segments.
Declaration
public var segmentsDescription: String { get }
var sourceMap: SourceMap
var sourceMap: SourceMap