Skip to content

do not emit double assignment of class expressions. #8786

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

Merged
merged 1 commit into from
May 26, 2016

Conversation

rkirov
Copy link
Contributor

@rkirov rkirov commented May 24, 2016

Closure compiler ES6 support rejects expressions of the form let A = B = class {}

With a small rewriting of the emitted code the case of decorated and
statically referenced classes, TypeScript ES6 emit satisfies this
requirement.

Before:
let C_1;
let C = C_1 = class C {};

After:
let C_1 = class C {};
let C = C_1;

@msftclas
Copy link

Hi @rkirov, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@mhegazy
Copy link
Contributor

mhegazy commented May 24, 2016

👍

@mhegazy
Copy link
Contributor

mhegazy commented May 24, 2016

@rbuckton can you take a look.

@mhegazy
Copy link
Contributor

mhegazy commented May 24, 2016

looks like the linter is complaining:

src/compiler/emitter.ts[5429, 27]: 'else' should not be on the same line as the preceeding block's curly brace

// export class C { | export let C = C_1 = class C {
// static x() { return C.y; } | static x() { return C_1.y; }
// static y = 1; | }
// @dec | let C = C_1 = class C {
Copy link
Contributor

Choose a reason for hiding this comment

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

extra C = in the comment.

Closure compiler ES6 support rejects expressions of the form `let A = B
= class {}`

With a small rewriting of the emitted code the case of decorated and
staticly referenced classes, TypeScript ES6 emit satisfies this
requirement.

Before:
let C_1;
let C = C_1 = class C {};

After:
let C_1 = class C {};
let C_1 = C;
@rkirov rkirov force-pushed the no_double_assignment branch from 10f71a8 to 699dc4f Compare May 24, 2016 23:26
@rkirov
Copy link
Contributor Author

rkirov commented May 24, 2016

took care of the comments. PTAL.

@mhegazy mhegazy merged commit 8aa6a9d into microsoft:master May 26, 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.

4 participants