Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on aliased, exported @enum tag in jsdoc #36996

Merged
merged 1 commit into from Feb 25, 2020

Conversation

sandersn
Copy link
Member

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"
};

Fixes #36983

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"
};
```
Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a backlog item to (attempt to) unhackify JS symbol binding and set up everything to use fresh symbols with SymbolFlags.Alias set, rather than the imprecise mixture of symbol copying, symbol substituting, and fake-symbol-flag-setting we do now?

@sandersn
Copy link
Member Author

Here it is: #37000

@sandersn sandersn merged commit 3e3df87 into master Feb 25, 2020
@sandersn sandersn deleted the fix-exported-enum-tag-crash branch February 25, 2020 00:13
@sandersn
Copy link
Member Author

@typescript-bot cherry-pick this to release-3.9

@typescript-bot
Copy link
Collaborator

Heya @sandersn, I couldn't find the branch 'release-3.9' on Microsoft/TypeScript. You may need to make it and try again.

@sandersn
Copy link
Member Author

@typescript-bot cherry-pick this to release-3.8

@weswigham
Copy link
Member

Here it is: #37000

Good number snipe 👍

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Feb 25, 2020
Component commits:
888ebf4 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"
};
```
@typescript-bot
Copy link
Collaborator

Hey @sandersn, I've opened #37002 for you.

sandersn added a commit that referenced this pull request Feb 25, 2020
Component commits:
888ebf4 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"
};
```

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot read property 'exports' of undefined
3 participants