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