Skip to content

do not emit double assignment of class expressions.#8786

Merged
mhegazy merged 1 commit into
microsoft:masterfrom
rkirov:no_double_assignment
May 26, 2016
Merged

do not emit double assignment of class expressions.#8786
mhegazy merged 1 commit into
microsoft:masterfrom
rkirov:no_double_assignment

Conversation

@rkirov

@rkirov rkirov commented May 24, 2016

Copy link
Copy Markdown
Contributor

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

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

mhegazy commented May 24, 2016

Copy link
Copy Markdown
Contributor

👍

@mhegazy

mhegazy commented May 24, 2016

Copy link
Copy Markdown
Contributor

@rbuckton can you take a look.

@mhegazy

mhegazy commented May 24, 2016

Copy link
Copy Markdown
Contributor

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

Comment thread src/compiler/emitter.ts Outdated
// 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
Copy Markdown
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

rkirov commented May 24, 2016

Copy link
Copy Markdown
Contributor Author

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