Skip to content

Commit f98369b

Browse files
committed
Fix the AV resulting from presence of undefined in the jsDocPropertyTags
Fixes microsoft#11703
1 parent 3bdff73 commit f98369b

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/compiler/parser.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6639,12 +6639,16 @@ namespace ts {
66396639
return true;
66406640
case "prop":
66416641
case "property":
6642-
if (!parentTag.jsDocPropertyTags) {
6643-
parentTag.jsDocPropertyTags = <NodeArray<JSDocPropertyTag>>[];
6644-
}
66456642
const propertyTag = parsePropertyTag(atToken, tagName);
6646-
parentTag.jsDocPropertyTags.push(propertyTag);
6647-
return true;
6643+
if (propertyTag) {
6644+
if (!parentTag.jsDocPropertyTags) {
6645+
parentTag.jsDocPropertyTags = <NodeArray<JSDocPropertyTag>>[];
6646+
}
6647+
parentTag.jsDocPropertyTags.push(propertyTag);
6648+
return true;
6649+
}
6650+
// Error parsing property tag
6651+
return false;
66486652
}
66496653
return false;
66506654
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// /**/
4+
5+
goTo.marker();
6+
verify.navigationItemsListCount(0, "foo", "exact");
7+
edit.insert("/**\n * @typedef {Object} foo\n * @property {any} [obj]\n */\nexport default function foo() {\n}");
8+
verify.navigationItemsListContains("foo", "function", "foo", "exact");

0 commit comments

Comments
 (0)