| 1465 | // its configuration might not match the current token’s type. |
| 1466 | // See <https://github.com/js-choi/proposal-hack-pipes>. |
| 1467 | parseTopicReference(pipeProposal: string): N.Expression { |
| 1468 | const node = this.startNode<N.TopicReference>(); |
| 1469 | const startLoc = this.state.startLoc; |
| 1470 | const tokenType = this.state.type; |
| 1471 | |
| 1472 | // Consume the current token. |
| 1473 | this.next(); |
| 1474 | |
| 1475 | // If the pipe-operator plugin’s configuration matches the current token’s type, |
| 1476 | // then this will return `node`, will have been finished as a topic reference. |
| 1477 | // Otherwise, this will throw a `PipeTopicUnconfiguredToken` error. |
| 1478 | return this.finishTopicReference(node, startLoc, pipeProposal, tokenType); |
| 1479 | } |
| 1480 | |
| 1481 | // This helper method attempts to finish the given `node` |
| 1482 | // into a topic-reference node for the given `pipeProposal`. |