(
node: Omit<T, "type">,
type: T["type"],
endNode: NodeType,
)
| 118 | } |
| 119 | |
| 120 | finishNodeAtNode<T extends NodeType>( |
| 121 | node: Omit<T, "type">, |
| 122 | type: T["type"], |
| 123 | endNode: NodeType, |
| 124 | ): T { |
| 125 | if (!process.env.IS_PUBLISH && node.end! > 0) { |
| 126 | throw new Error( |
| 127 | "Do not call finishNode*() twice on the same node." + |
| 128 | " Instead use resetEndLocation() or change type directly.", |
| 129 | ); |
| 130 | } |
| 131 | (node as T).type = type; |
| 132 | node.end = endNode.end; |
| 133 | const { optionFlags } = this; |
| 134 | if (optionFlags & OptionFlags.Locations) { |
| 135 | node.loc!.end = endNode.loc!.end; |
| 136 | } |
| 137 | if (optionFlags & OptionFlags.Ranges) node.range![1] = node.end!; |
| 138 | if (optionFlags & OptionFlags.AttachComment) this.processComment(node as T); |
| 139 | return node as T; |
| 140 | } |
| 141 | |
| 142 | resetStartLocation(node: BaseNode, startLoc: Position): void { |
| 143 | node.start = startLoc.index; |
nothing calls this directly
no test coverage detected