(this: Parser, isTagged: boolean)
| 2052 | |
| 2053 | // https://tc39.es/ecma262/#prod-TemplateLiteral |
| 2054 | parseTemplate(this: Parser, isTagged: boolean): N.TemplateLiteral { |
| 2055 | const node = this.startNode<N.TemplateLiteral>(); |
| 2056 | let curElt = this.parseTemplateElement(isTagged); |
| 2057 | const quasis = [curElt]; |
| 2058 | const substitutions = []; |
| 2059 | while (!curElt.tail) { |
| 2060 | substitutions.push(this.parseTemplateSubstitution()); |
| 2061 | this.readTemplateContinuation(); |
| 2062 | quasis.push((curElt = this.parseTemplateElement(isTagged))); |
| 2063 | } |
| 2064 | // Type cast from (N.Expression[] | N.TSType[]). parseTemplateSubstitution |
| 2065 | // returns consistent results. |
| 2066 | node.expressions = substitutions; |
| 2067 | node.quasis = quasis; |
| 2068 | return this.finishNode(node, "TemplateLiteral"); |
| 2069 | } |
| 2070 | |
| 2071 | // This is overwritten by the TypeScript plugin to parse template types |
| 2072 | parseTemplateSubstitution(this: Parser): N.Expression | N.TSType { |
nothing calls this directly
no test coverage detected