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