MCPcopy Create free account
hub / github.com/babel/babel / _normalizePosition

Method _normalizePosition

packages/babel-generator/src/buffer.ts:364–376  ·  view source on GitHub ↗
(prop: "start" | "end", loc: Loc, columnOffset: number)

Source from the content-addressed store, hash-verified

362 }
363
364 _normalizePosition(prop: "start" | "end", loc: Loc, columnOffset: number) {
365 this._flush();
366
367 const pos = loc[prop];
368 if (pos) {
369 this.setSourcePosition(
370 pos.line,
371 // TODO: Fix https://github.com/babel/babel/issues/15712 in downstream
372 Math.max(pos.column + columnOffset, 0),
373 );
374 this._sourcePosition.filename = loc.filename;
375 }
376 }
377
378 setSourcePosition(line: number, column: number): void {
379 const target = this._sourcePosition;

Callers 2

sourceMethod · 0.95
sourceWithOffsetMethod · 0.95

Calls 2

_flushMethod · 0.95
setSourcePositionMethod · 0.95

Tested by

no test coverage detected