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 elided syntax kinds falling through to visitConstructor in TypeScript transformer #12639

Merged
merged 1 commit into from
Dec 3, 2016
Merged

Fix elided syntax kinds falling through to visitConstructor in TypeScript transformer #12639

merged 1 commit into from
Dec 3, 2016

Conversation

MattiasBuelens
Copy link
Contributor

@MattiasBuelens MattiasBuelens commented Dec 3, 2016

The TypeScript transformer elides a bunch of syntax kinds that should not appear in the emitted JavaScript code (e.g. access modifiers, types,...). Normally, this elision would be done by returning undefined from the visitor.

This commit changed the handling for SyntaxKind.Constructor: previously constructors were elided, but now visitConstructor handles them. However, the commit forgot to stop the cases above the SyntaxKind.Constructor case falling through, so now all cases that should just have return undefined actually call visitConstructor instead. Luckily, visitConstructor returns undefined when its argument is not a function-like declaration, which is why the code works and passes the tests... although it works for the wrong reason. 😛

This change re-introduces the missing return undefined statement, so the elided cases no longer fall through to visitConstructor.

@msftclas
Copy link

msftclas commented Dec 3, 2016

Hi @MattiasBuelens, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@DanielRosenwasser DanielRosenwasser merged commit f61a224 into microsoft:master Dec 3, 2016
@DanielRosenwasser
Copy link
Member

Thanks for catching that!

@MattiasBuelens MattiasBuelens deleted the fixElideFallthrough branch December 3, 2016 22:49
@mhegazy mhegazy mentioned this pull request Dec 5, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
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.

3 participants