(
node: Omit<T, "type">,
type: T["type"],
endLoc: Position,
)
| 98 | // Finish node at given position |
| 99 | |
| 100 | finishNodeAt<T extends NodeType>( |
| 101 | node: Omit<T, "type">, |
| 102 | type: T["type"], |
| 103 | endLoc: Position, |
| 104 | ): T { |
| 105 | if (!process.env.IS_PUBLISH && node.end! > 0) { |
| 106 | throw new Error( |
| 107 | "Do not call finishNode*() twice on the same node." + |
| 108 | " Instead use resetEndLocation() or change type directly.", |
| 109 | ); |
| 110 | } |
| 111 | (node as T).type = type; |
| 112 | node.end = endLoc.index; |
| 113 | const { optionFlags } = this; |
| 114 | if (optionFlags & OptionFlags.Locations) { |
| 115 | node.loc!.end = this.createPosition(endLoc); |
| 116 | } |
| 117 | if (optionFlags & OptionFlags.Ranges) node.range![1] = endLoc.index; |
| 118 | if (optionFlags & OptionFlags.AttachComment) this.processComment(node as T); |
| 119 | return node as T; |
| 120 | } |
| 121 | |
| 122 | finishNodeAtNode<T extends NodeType>( |
| 123 | node: Omit<T, "type">, |
nothing calls this directly
no test coverage detected