forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash on aliased,exported @enum tag in jsdoc
THe code to bind `@enum` and `@typedef` didn't handle the case that the `@enum` was on a property assignment to an alias of module.exports. Specifically, `x` needs to be correctly aliased to the file's symbol in the example below: ``` var x = module.exports = {}; /** @enum {string} */ x.E = { A: "A" }; ```
- Loading branch information
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
=== tests/cases/conformance/jsdoc/exportedAliasedEnumTag.js === | ||
var middlewarify = module.exports = {}; | ||
>middlewarify : Symbol(middlewarify, Decl(exportedAliasedEnumTag.js, 0, 3)) | ||
>module.exports : Symbol("tests/cases/conformance/jsdoc/exportedAliasedEnumTag", Decl(exportedAliasedEnumTag.js, 0, 0)) | ||
>module : Symbol(module, Decl(exportedAliasedEnumTag.js, 0, 18)) | ||
>exports : Symbol("tests/cases/conformance/jsdoc/exportedAliasedEnumTag", Decl(exportedAliasedEnumTag.js, 0, 0)) | ||
|
||
/** @enum */ | ||
middlewarify.Type = { | ||
>middlewarify.Type : Symbol(Type, Decl(exportedAliasedEnumTag.js, 0, 39), Decl(exportedAliasedEnumTag.js, 3, 13), Decl(exportedAliasedEnumTag.js, 2, 4)) | ||
>middlewarify : Symbol(middlewarify, Decl(exportedAliasedEnumTag.js, 0, 3)) | ||
>Type : Symbol(Type, Decl(exportedAliasedEnumTag.js, 0, 39), Decl(exportedAliasedEnumTag.js, 3, 13), Decl(exportedAliasedEnumTag.js, 2, 4)) | ||
|
||
BEFORE: 'before' | ||
>BEFORE : Symbol(BEFORE, Decl(exportedAliasedEnumTag.js, 3, 21)) | ||
|
||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
=== tests/cases/conformance/jsdoc/exportedAliasedEnumTag.js === | ||
var middlewarify = module.exports = {}; | ||
>middlewarify : typeof import("tests/cases/conformance/jsdoc/exportedAliasedEnumTag") | ||
>module.exports = {} : typeof import("tests/cases/conformance/jsdoc/exportedAliasedEnumTag") | ||
>module.exports : typeof import("tests/cases/conformance/jsdoc/exportedAliasedEnumTag") | ||
>module : { "\"tests/cases/conformance/jsdoc/exportedAliasedEnumTag\"": typeof import("tests/cases/conformance/jsdoc/exportedAliasedEnumTag"); } | ||
>exports : typeof import("tests/cases/conformance/jsdoc/exportedAliasedEnumTag") | ||
>{} : {} | ||
|
||
/** @enum */ | ||
middlewarify.Type = { | ||
>middlewarify.Type = { BEFORE: 'before'} : { BEFORE: string; } | ||
>middlewarify.Type : { BEFORE: string; } | ||
>middlewarify : typeof import("tests/cases/conformance/jsdoc/exportedAliasedEnumTag") | ||
>Type : { BEFORE: string; } | ||
>{ BEFORE: 'before'} : { BEFORE: string; } | ||
|
||
BEFORE: 'before' | ||
>BEFORE : string | ||
>'before' : "before" | ||
|
||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @noemit: true | ||
// @allowjs: true | ||
// @filename: exportedAliasedEnumTag.js | ||
var middlewarify = module.exports = {}; | ||
|
||
/** @enum */ | ||
middlewarify.Type = { | ||
BEFORE: 'before' | ||
}; |