Start a new node with a previous node's location.
(
type: Undone<NodeType>,
)
| 69 | |
| 70 | /** Start a new node with a previous node's location. */ |
| 71 | startNodeAtNode<T extends NodeType = never>( |
| 72 | type: Undone<NodeType>, |
| 73 | ): Undone<T> { |
| 74 | const { optionFlags, filename } = this; |
| 75 | if (!(optionFlags & OptionFlags.Locations)) { |
| 76 | return new Node( |
| 77 | optionFlags, |
| 78 | filename, |
| 79 | type.start!, |
| 80 | ) as unknown as Undone<T>; |
| 81 | } |
| 82 | return new Node( |
| 83 | optionFlags, |
| 84 | filename, |
| 85 | type.start!, |
| 86 | type.loc!.start, |
| 87 | ) as unknown as Undone<T>; |
| 88 | } |
| 89 | |
| 90 | // Finish an AST node, adding `type` and `end` properties. |
| 91 |
nothing calls this directly
no outgoing calls
no test coverage detected