Skip to content

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

Merged
DanielRosenwasser merged 1 commit into
microsoft:masterfrom
MattiasBuelens:fixElideFallthrough
Dec 3, 2016
Merged

Fix elided syntax kinds falling through to visitConstructor in TypeScript transformer#12639
DanielRosenwasser merged 1 commit into
microsoft:masterfrom
MattiasBuelens:fixElideFallthrough

Conversation

@MattiasBuelens

@MattiasBuelens MattiasBuelens commented Dec 3, 2016

Copy link
Copy Markdown
Contributor

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

msftclas commented Dec 3, 2016

Copy link
Copy Markdown

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
Copy Markdown
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