(kind, rawText)
| 27256 | var rawTextScanner; |
| 27257 | var invalidValueSentinel = {}; |
| 27258 | function getCookedText(kind, rawText) { |
| 27259 | if (!rawTextScanner) { |
| 27260 | rawTextScanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ false, 0 /* LanguageVariant.Standard */); |
| 27261 | } |
| 27262 | switch (kind) { |
| 27263 | case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: |
| 27264 | rawTextScanner.setText("`" + rawText + "`"); |
| 27265 | break; |
| 27266 | case 15 /* SyntaxKind.TemplateHead */: |
| 27267 | // tslint:disable-next-line no-invalid-template-strings |
| 27268 | rawTextScanner.setText("`" + rawText + "${"); |
| 27269 | break; |
| 27270 | case 16 /* SyntaxKind.TemplateMiddle */: |
| 27271 | // tslint:disable-next-line no-invalid-template-strings |
| 27272 | rawTextScanner.setText("}" + rawText + "${"); |
| 27273 | break; |
| 27274 | case 17 /* SyntaxKind.TemplateTail */: |
| 27275 | rawTextScanner.setText("}" + rawText + "`"); |
| 27276 | break; |
| 27277 | } |
| 27278 | var token = rawTextScanner.scan(); |
| 27279 | if (token === 19 /* SyntaxKind.CloseBraceToken */) { |
| 27280 | token = rawTextScanner.reScanTemplateToken(/*isTaggedTemplate*/ false); |
| 27281 | } |
| 27282 | if (rawTextScanner.isUnterminated()) { |
| 27283 | rawTextScanner.setText(undefined); |
| 27284 | return invalidValueSentinel; |
| 27285 | } |
| 27286 | var tokenValue; |
| 27287 | switch (token) { |
| 27288 | case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: |
| 27289 | case 15 /* SyntaxKind.TemplateHead */: |
| 27290 | case 16 /* SyntaxKind.TemplateMiddle */: |
| 27291 | case 17 /* SyntaxKind.TemplateTail */: |
| 27292 | tokenValue = rawTextScanner.getTokenValue(); |
| 27293 | break; |
| 27294 | } |
| 27295 | if (tokenValue === undefined || rawTextScanner.scan() !== 1 /* SyntaxKind.EndOfFileToken */) { |
| 27296 | rawTextScanner.setText(undefined); |
| 27297 | return invalidValueSentinel; |
| 27298 | } |
| 27299 | rawTextScanner.setText(undefined); |
| 27300 | return tokenValue; |
| 27301 | } |
| 27302 | function propagateIdentifierNameFlags(node) { |
| 27303 | // An IdentifierName is allowed to be `await` |
| 27304 | return propagateChildFlags(node) & ~16777216 /* TransformFlags.ContainsPossibleTopLevelAwait */; |
no outgoing calls
no test coverage detected