fix(es/codegen): Fix codegen of arrow expressions (#4306)

Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com>
This commit is contained in:
Dion 2022-04-15 10:00:04 +02:00 committed by GitHub
parent 995b4367cc
commit 4c9973010a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 12 deletions

View File

@ -940,6 +940,13 @@ where
punct!(")");
}
if let Some(ty) = &node.return_type {
punct!(":");
formatting_space!();
emit!(ty);
formatting_space!();
}
punct!("=>");
emit!(node.body);

View File

@ -1,6 +1,6 @@
var f3 = <T__2, U__2 extends T__2>(x__2: T__2, y__2: U__2)=>{
function bar__2<V__3 extends T__2, W__3 extends U__2>() {
var g__3 = <X__4 extends W__3, Y__4 extends V__3>(a__4: X__4, b__4: Y__4)=>{
var g__3 = <X__4 extends W__3, Y__4 extends V__3>(a__4: X__4, b__4: Y__4): T__2 =>{
x__2 = y__2;
return y__2;
};
@ -8,7 +8,7 @@ var f3 = <T__2, U__2 extends T__2>(x__2: T__2, y__2: U__2)=>{
};
var f4 = <U__5 extends T__5, T__5>(x__5: T__5, y__5: U__5)=>{
function bar__5<V__6 extends T__5, W__6 extends U__5>() {
var g__6 = <X__7 extends W__6, Y__7 extends V__6>(a__7: X__7, b__7: Y__7)=>{
var g__6 = <X__7 extends W__6, Y__7 extends V__6>(a__7: X__7, b__7: Y__7): T__5 =>{
x__5 = y__5;
return y__5;
};

View File

@ -29,7 +29,7 @@ function foo2<U__9 extends T__9, T__9>(x__9: T__9, y__9: U__9): W {
}
var f3 = <T__12, U__12 extends T__12>(x__12: T__12, y__12: U__12)=>{
function bar__12<V__13 extends T__12, W__13 extends U__12>(r__13: X, s__13: Y) {
var g__13 = <X__14 extends W__13, Y__14 extends V__13>(a__14: X__14, b__14: Y__14)=>{
var g__13 = <X__14 extends W__13, Y__14 extends V__13>(a__14: X__14, b__14: Y__14): T__12 =>{
x__12 = y__12;
return y__12;
};
@ -37,7 +37,7 @@ var f3 = <T__12, U__12 extends T__12>(x__12: T__12, y__12: U__12)=>{
};
var f4 = <U__15 extends T__15, T__15>(x__15: V, y__15: X)=>{
function bar__15<V__16 extends T__15, W__16 extends U__15>() {
var g__16 = <X__17 extends W__16, Y__17 extends V__16>(a__17: X__17, b__17: Y__17)=>{
var g__16 = <X__17 extends W__16, Y__17 extends V__16>(a__17: X__17, b__17: Y__17): T__15 =>{
x__15 = y__15;
return y__15;
};

View File

@ -14,11 +14,11 @@ var f2 = function<U__5 extends T__5, T__5>(x__5: T__5, y__5: U__5): T__5 {
x__5 = y__5;
return y__5;
};
var f3 = <T__6, U__6 extends T__6>(x__6: T__6, y__6: U__6)=>{
var f3 = <T__6, U__6 extends T__6>(x__6: T__6, y__6: U__6): T__6 =>{
x__6 = y__6;
return y__6;
};
var f4 = <U__7 extends T__7, T__7>(x__7: T__7, y__7: U__7)=>{
var f4 = <U__7 extends T__7, T__7>(x__7: T__7, y__7: U__7): T__7 =>{
x__7 = y__7;
return y__7;
};

View File

@ -1,4 +1,4 @@
var f3 = <T__2, U__2 extends T__2>(x__2: T__2, y__2: U__2)=>{
var f3 = <T__2, U__2 extends T__2>(x__2: T__2, y__2: U__2): T__2 =>{
x__2 = y__2;
return y__2;
};

View File

@ -1,4 +1,4 @@
var f4 = <U__2 extends T__2, T__2>(x__2: T__2, y__2: U__2)=>{
var f4 = <U__2 extends T__2, T__2>(x__2: T__2, y__2: U__2): T__2 =>{
x__2 = y__2;
return y__2;
};

View File

@ -2114,7 +2114,7 @@ export default (identifier: string, level = 0, b = "", m = false) => {
const proseTypes = new Map();
// deno-lint-ignore ban-types
const prose = (l, i, nl, bp): string => {
const prose = (l, i, nl, bp) => {
return i(l) + bp + "prose {" + nl +
i(l + 1) + "color: #374151;" + nl +
i(l + 1) + "max-width: 65ch;" + nl +
@ -2407,7 +2407,7 @@ export default (identifier: string, level = 0, b = "", m = false) => {
proseTypes.set("prose", prose);
// deno-lint-ignore ban-types
const proseSm = (l, i, nl, bp): string => {
const proseSm = (l, i, nl, bp) => {
return i(l) + bp + "prose-sm {" + nl +
i(l + 1) + "font-size: 0.875rem;" + nl +
i(l + 1) + "line-height: 1.7142857;" + nl +
@ -2595,7 +2595,7 @@ export default (identifier: string, level = 0, b = "", m = false) => {
proseTypes.set("prose-sm", proseSm);
// deno-lint-ignore ban-types
const proseLg = (l, i, nl, bp): string => {
const proseLg = (l, i, nl, bp) => {
return i(l) + bp + "prose-lg {" + nl +
i(l + 1) + "font-size: 1.125rem;" + nl +
i(l + 1) + "line-height: 1.7777778;" + nl +
@ -2783,7 +2783,7 @@ export default (identifier: string, level = 0, b = "", m = false) => {
proseTypes.set("prose-lg", proseLg);
// deno-lint-ignore ban-types
const proseXl = (l, i, nl, bp): string => {
const proseXl = (l, i, nl, bp) => {
return i(l) + bp + "prose-xl {" + nl +
i(l + 1) + "font-size: 1.25rem;" + nl +
i(l + 1) + "line-height: 1.8;" + nl +