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

Function startNodeAt

packages/babel-parser/src/parser/node.ts:56–68  ·  view source on GitHub ↗
(loc: Position)

Source from the content-addressed store, hash-verified

54 }
55
56 startNodeAt<T extends NodeType = never>(loc: Position): Undone<T> {
57 this.setLoc(loc);
58 const { optionFlags, filename } = this;
59 if (!(optionFlags & OptionFlags.Locations)) {
60 return new Node(optionFlags, filename, loc.index) as unknown as Undone<T>;
61 }
62 return new Node(
63 optionFlags,
64 filename,
65 loc.index,
66 this.createPosition(loc),
67 ) as unknown as Undone<T>;
68 }
69
70 /** Start a new node with a previous node's location. */
71 startNodeAtNode<T extends NodeType = never>(

Callers

nothing calls this directly

Calls 1

createPositionMethod · 0.80

Tested by

no test coverage detected