MCPcopy
hub / github.com/vuejs/core / addMapping

Function addMapping

packages/compiler-core/src/codegen.ts:256–270  ·  view source on GitHub ↗
(loc: Position, name: string | null = null)

Source from the content-addressed store, hash-verified

254 }
255
256 function addMapping(loc: Position, name: string | null = null) {
257 // we use the private property to directly add the mapping
258 // because the addMapping() implementation in source-map-js has a bunch of
259 // unnecessary arg and validation checks that are pure overhead in our case.
260 const { _names, _mappings } = context.map!
261 if (name !== null && !_names.has(name)) _names.add(name)
262 _mappings.add({
263 originalLine: loc.line,
264 originalColumn: loc.column - 1, // source-map column is 0 based
265 generatedLine: context.line,
266 generatedColumn: context.column - 1,
267 source: filename,
268 name,
269 })
270 }
271
272 if (!__BROWSER__ && sourceMap) {
273 // lazy require source-map implementation, only in non-browser builds

Callers 1

pushFunction · 0.70

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected