Skip to content

If parsing a function type fails, parseTypeReference() to ensure something is returned#24567

Merged
7 commits merged into
masterfrom
jsdocFunctionTypeFalsePositive
Jun 5, 2018
Merged

If parsing a function type fails, parseTypeReference() to ensure something is returned#24567
7 commits merged into
masterfrom
jsdocFunctionTypeFalsePositive

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Jun 1, 2018

Fixes #24565

@ghost ghost requested a review from sandersn June 1, 2018 15:11
@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Jun 1, 2018

Please port to release-2.9 as well

Copy link
Copy Markdown
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

This is OK for a quick fix for 2.9, but is there a way to avoid tryParse? Could you reasonably duplicate the failure behaviour of parseTypeReference by calling createMissingNode directly?

@sandersn
Copy link
Copy Markdown
Member

sandersn commented Jun 1, 2018

Couple of asides: looks like the current commit has a missing semi-colon and a TODO left in.

@ghost
Copy link
Copy Markdown
Author

ghost commented Jun 1, 2018

Actually, I'd like to leave the TODO in because parameters is typed as always being defined, and needs a ! in fillSignature that's suspicious.

@ghost
Copy link
Copy Markdown
Author

ghost commented Jun 4, 2018

@sandersn I know you've reviewed this a bunch of times already, but could you look at the last commit 77372fd ?

Comment thread src/compiler/parser.ts Outdated
signature.typeParameters = parseTypeParameters();
}
signature.parameters = parseParameterList(flags)!; // TODO: GH#18217
const parsedParameters = parseParameterList(signature, flags); // TODO: GH#18217
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(1) remove comment (2) rename parsedParameters

@ghost ghost merged commit 735a46f into master Jun 5, 2018
@ghost ghost deleted the jsdocFunctionTypeFalsePositive branch June 5, 2018 17:24
ghost pushed a commit that referenced this pull request Jun 5, 2018
…thing is returned (#24567)

* If parsing a function type fails, parseTypeReference() to ensure something is returned

* Avoid tryParse

* Add missing semicolon

* Don't check for undefined, check for missing type

* Don't set parameters undefined, set to missingList and return false

* Update API baselines

* Code review
ghost pushed a commit that referenced this pull request Jun 5, 2018
…thing is returned (#24567) (#24695)

* If parsing a function type fails, parseTypeReference() to ensure something is returned

* Avoid tryParse

* Add missing semicolon

* Don't check for undefined, check for missing type

* Don't set parameters undefined, set to missingList and return false

* Update API baselines

* Code review
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants