Merge pull request #11830 from Microsoft/jsDocAV

Fix the AV resulting from presence of undefined in the jsDocPropertyTags
This commit is contained in:
Sheetal Nandi
2016-10-25 10:42:49 -07:00
committed by GitHub
2 changed files with 17 additions and 5 deletions

View File

@@ -6639,12 +6639,16 @@ namespace ts {
return true;
case "prop":
case "property":
if (!parentTag.jsDocPropertyTags) {
parentTag.jsDocPropertyTags = <NodeArray<JSDocPropertyTag>>[];
}
const propertyTag = parsePropertyTag(atToken, tagName);
parentTag.jsDocPropertyTags.push(propertyTag);
return true;
if (propertyTag) {
if (!parentTag.jsDocPropertyTags) {
parentTag.jsDocPropertyTags = <NodeArray<JSDocPropertyTag>>[];
}
parentTag.jsDocPropertyTags.push(propertyTag);
return true;
}
// Error parsing property tag
return false;
}
return false;
}

View File

@@ -0,0 +1,8 @@
///<reference path="fourslash.ts" />
//// /**/
goTo.marker();
verify.navigationItemsListCount(0, "foo", "exact");
edit.insert("/**\n * @typedef {Object} foo\n * @property {any} [obj]\n */\nexport default function foo() {\n}");
verify.navigationItemsListContains("foo", "function", "foo", "exact");