mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-02 14:48:32 -05:00
Run fixupParentReferences when parsing isolated jsDocComment
This commit is contained in:
@@ -440,7 +440,26 @@ namespace ts {
|
||||
|
||||
/* @internal */
|
||||
export function parseIsolatedJSDocComment(content: string, start?: number, length?: number) {
|
||||
return Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length);
|
||||
const result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length);
|
||||
if (result.jsDocComment) {
|
||||
// because the jsDocComment was parsed out of the source file, it might
|
||||
// not be covered by the fixupParentReferences.
|
||||
let parentNode: Node = result.jsDocComment;
|
||||
forEachChild(result.jsDocComment, visitNode);
|
||||
|
||||
function visitNode(n: Node): void {
|
||||
if (n.parent !== parentNode) {
|
||||
n.parent = parentNode;
|
||||
|
||||
const saveParent = parentNode;
|
||||
parentNode = n;
|
||||
forEachChild(n, visitNode);
|
||||
parentNode = saveParent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
/////** @template T */
|
||||
////function ident<T>: T {
|
||||
////}
|
||||
|
||||
var c = classification;
|
||||
verify.syntacticClassificationsAre(
|
||||
c.comment("/** "),
|
||||
c.punctuation("@"),
|
||||
c.docCommentTagName("template"),
|
||||
c.typeParameterName("T"),
|
||||
c.comment(" */"),
|
||||
c.keyword("function"),
|
||||
c.identifier("ident"),
|
||||
c.punctuation("<"),
|
||||
c.typeParameterName("T"),
|
||||
c.punctuation(">"),
|
||||
c.punctuation(":"),
|
||||
c.identifier("T"),
|
||||
c.punctuation("{"),
|
||||
c.punctuation("}"));
|
||||
Reference in New Issue
Block a user