Skip to content

Emit rest parameters natively in ES6 - #1370

Closed
Yui (yuit) wants to merge 5 commits into
masterfrom
emitRestParamNatively
Closed

Yui (yuit) wants to merge 5 commits into
masterfrom
emitRestParamNatively

Conversation

@yuit

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/harness/fourslash.ts Outdated

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.

remove this please

@sheetalkamat

Copy link
Copy Markdown
Member

👍

Comment thread src/compiler/emitter.ts Outdated

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.

Why not just have

if (options.target < ScriptTarget.ES6) {
    emitCommaList(node.parameters, /*includeTrailingComma*/ false, numberOfParameters - (hasRestParam ? 1 : 0));
}
else {
    emitCommaList(node.parameters, /*includeTrailingComma*/ false, numberOfParameters);
}

and make a modified emitParameter with

if (node.flags & NodeFlags.Rest) {
    write("...");
}

and also rename the existing emitParameter to emitDownlevelParameter?

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.

This sounds better to me as well.

@CyrusNajmabadi

Copy link
Copy Markdown
Contributor

💯

@ahejlsberg

Copy link
Copy Markdown
Member

Superceded by #1463.

@yuit
Yui (yuit) deleted the emitRestParamNatively branch February 12, 2015 18:27
@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jun 18, 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.

5 participants