-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Emit arrow function es6 #1627
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
Emit arrow function es6 #1627
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
436baaf
Add default target in compiler option of project runner
b0ea401
Emit Arrow function natively in ES6
7d0fc62
Emit this binding natively in es6
cb48a5e
Add testcases
ba239c5
Address code review
581beb5
Merge branch 'master' into emitArrowFunctionES6
de9547c
Update type checking for lexical binding due to merge with master
593a099
Update emitter due to merge with master
3115288
Update baseline and fix white space
f219a2d
Address code review; preserve users non-parenthesis
15b05e6
Merge branch 'master' into emitArrowFunctionES6
2e2559b
Update tests baseline from merging with master
ca3c1ed
Address the issue that arrow function doesn't have arguments objects
d5b953d
Add testcases
70140ef
Fix spacing due to tab
8d731d4
Address code review
2b200d4
Address code review
9b04180
Change tab to space
e4b206c
Merge branch 'master' into emitArrowFunctionES6
fd20695
Remove flag and compare position
fb2c502
Clean up the checking of position
cf5aadb
Address code review
5d0376f
Address codereview
6a0eaf5
Update an error
4162671
Address code review
ff038fb
Merge branch 'master' into emitArrowFunctionES6
a595a78
Remove tabs in json
53dffda
Merge branch 'master' into emitArrowFunctionES6
0d53542
Merge branch 'master' into emitArrowFunctionES6
122d587
Merge branch 'master' into emitArrowFunctionES6
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//// [emitArrowFunction.ts] | ||
var f1 = () => { } | ||
var f2 = (x: string, y: string) => { } | ||
var f3 = (x: string, y: number, ...rest) => { } | ||
var f4 = (x: string, y: number, z = 10) => { } | ||
function foo(func: () => boolean) { } | ||
foo(() => true); | ||
foo(() => { return false; }); | ||
|
||
//// [emitArrowFunction.js] | ||
var f1 = function () { | ||
}; | ||
var f2 = function (x, y) { | ||
}; | ||
var f3 = function (x, y) { | ||
var rest = []; | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
rest[_i - 2] = arguments[_i]; | ||
} | ||
}; | ||
var f4 = function (x, y, z) { | ||
if (z === void 0) { z = 10; } | ||
}; | ||
function foo(func) { | ||
} | ||
foo(function () { return true; }); | ||
foo(function () { | ||
return false; | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunction.ts === | ||
var f1 = () => { } | ||
>f1 : () => void | ||
>() => { } : () => void | ||
|
||
var f2 = (x: string, y: string) => { } | ||
>f2 : (x: string, y: string) => void | ||
>(x: string, y: string) => { } : (x: string, y: string) => void | ||
>x : string | ||
>y : string | ||
|
||
var f3 = (x: string, y: number, ...rest) => { } | ||
>f3 : (x: string, y: number, ...rest: any[]) => void | ||
>(x: string, y: number, ...rest) => { } : (x: string, y: number, ...rest: any[]) => void | ||
>x : string | ||
>y : number | ||
>rest : any[] | ||
|
||
var f4 = (x: string, y: number, z = 10) => { } | ||
>f4 : (x: string, y: number, z?: number) => void | ||
>(x: string, y: number, z = 10) => { } : (x: string, y: number, z?: number) => void | ||
>x : string | ||
>y : number | ||
>z : number | ||
|
||
function foo(func: () => boolean) { } | ||
>foo : (func: () => boolean) => void | ||
>func : () => boolean | ||
|
||
foo(() => true); | ||
>foo(() => true) : void | ||
>foo : (func: () => boolean) => void | ||
>() => true : () => boolean | ||
|
||
foo(() => { return false; }); | ||
>foo(() => { return false; }) : void | ||
>foo : (func: () => boolean) => void | ||
>() => { return false; } : () => boolean | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//// [emitArrowFunctionAsIs.ts] | ||
var arrow1 = a => { }; | ||
var arrow2 = (a) => { }; | ||
|
||
var arrow3 = (a, b) => { }; | ||
|
||
//// [emitArrowFunctionAsIs.js] | ||
var arrow1 = function (a) { | ||
}; | ||
var arrow2 = function (a) { | ||
}; | ||
var arrow3 = function (a, b) { | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionAsIs.ts === | ||
var arrow1 = a => { }; | ||
>arrow1 : (a: any) => void | ||
>a => { } : (a: any) => void | ||
>a : any | ||
|
||
var arrow2 = (a) => { }; | ||
>arrow2 : (a: any) => void | ||
>(a) => { } : (a: any) => void | ||
>a : any | ||
|
||
var arrow3 = (a, b) => { }; | ||
>arrow3 : (a: any, b: any) => void | ||
>(a, b) => { } : (a: any, b: any) => void | ||
>a : any | ||
>b : any | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//// [emitArrowFunctionAsIsES6.ts] | ||
var arrow1 = a => { }; | ||
var arrow2 = (a) => { }; | ||
|
||
var arrow3 = (a, b) => { }; | ||
|
||
//// [emitArrowFunctionAsIsES6.js] | ||
var arrow1 = a => { | ||
}; | ||
var arrow2 = (a) => { | ||
}; | ||
var arrow3 = (a, b) => { | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be really helpful if the baseline stated the target, just like the original test.