()
| 36337 | return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; |
| 36338 | } |
| 36339 | function parseDeclaration() { |
| 36340 | // TODO: Can we hold onto the parsed decorators/modifiers and advance the scanner |
| 36341 | // if we can't reuse the declaration, so that we don't do this work twice? |
| 36342 | // |
| 36343 | // `parseListElement` attempted to get the reused node at this position, |
| 36344 | // but the ambient context flag was not yet set, so the node appeared |
| 36345 | // not reusable in that context. |
| 36346 | var isAmbient = ts.some(lookAhead(function () { return (parseDecorators(), parseModifiers()); }), isDeclareModifier); |
| 36347 | if (isAmbient) { |
| 36348 | var node = tryReuseAmbientDeclaration(); |
| 36349 | if (node) { |
| 36350 | return node; |
| 36351 | } |
| 36352 | } |
| 36353 | var pos = getNodePos(); |
| 36354 | var hasJSDoc = hasPrecedingJSDocComment(); |
| 36355 | var decorators = parseDecorators(); |
| 36356 | var modifiers = parseModifiers(); |
| 36357 | if (isAmbient) { |
| 36358 | for (var _i = 0, _a = modifiers; _i < _a.length; _i++) { |
| 36359 | var m = _a[_i]; |
| 36360 | m.flags |= 16777216 /* NodeFlags.Ambient */; |
| 36361 | } |
| 36362 | return doInsideOfContext(16777216 /* NodeFlags.Ambient */, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); }); |
| 36363 | } |
| 36364 | else { |
| 36365 | return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); |
| 36366 | } |
| 36367 | } |
| 36368 | function tryReuseAmbientDeclaration() { |
| 36369 | return doInsideOfContext(16777216 /* NodeFlags.Ambient */, function () { |
| 36370 | var node = currentNode(parsingContext); |
no test coverage detected
searching dependent graphs…