Skip to content

Commit

Permalink
Fix iterator runtime mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
lxsmnsyc committed Dec 6, 2023
1 parent 2c1d3ab commit e158298
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion packages/seroval/src/core/context/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ export default abstract class BaseSerializerContext implements PluginAccessOptio
'if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)',
) + '}),t={[' + this.getRefParam(symbol.i) + ']:' + this.createFunction([], 't') + ',next:' + this.createEffectfulFunction(
['i', 't', 'v'],
'if(d===-1){return((i=c++)>=b.length)?(p.push(t=' + this.getRefParam(promise.i) + '()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],c!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}',
'if(d===-1){return((i=c++)>=b.length)?(p.push(t=' + this.getRefParam(promise.i) + '()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],i!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}',
) + '})',
),
),
Expand Down
2 changes: 1 addition & 1 deletion packages/seroval/src/core/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export function streamToAsyncIterable<T>(
}
const current = count++;
const value = buffer[current];
if (count !== doneAt) {
if (current !== doneAt) {
return { done: false, value };
}
if (isThrow) {
Expand Down
14 changes: 7 additions & 7 deletions packages/seroval/test/__snapshots__/async-iterable.test.ts.snap

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions packages/seroval/test/__snapshots__/frozen-object.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ exports[`frozen object > crossSerialize > supports self-recursion 1`] = `"($R[0]

exports[`frozen object > crossSerializeAsync > scoped > supports Objects 1`] = `"($R=>$R[0]=Promise.resolve($R[1]={hello:"world"}),Object.freeze($R[1]),$R[0])($R["example"])"`;

exports[`frozen object > crossSerializeAsync > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:(($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p),$R[2]=s=>(b,c,p,d,e,t,f)=>(b=[],c=0,p=[],d=-1,e=!1,f=(i,l)=>{for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})},s.on({next:(v,t)=>{if(t=p.shift())t.s({done:!1,value:v});b.push(v)},throw:(v,t)=>{if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)},return:(v,t)=>{if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)}}),t={[$R[1]]:()=>t,next:(i,t,v)=>{if(d===-1){return((i=c++)>=b.length)?(p.push(t=$R[3]()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],c!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}}})))(($R[4]=($R[5]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),$R[4].next(1),$R[4].next(2),$R[4].next(3),$R[4].return(void 0),$R[4]))},Object.freeze($R[0]),$R[0])($R["example"])"`;
exports[`frozen object > crossSerializeAsync > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:(($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p),$R[2]=s=>(b,c,p,d,e,t,f)=>(b=[],c=0,p=[],d=-1,e=!1,f=(i,l)=>{for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})},s.on({next:(v,t)=>{if(t=p.shift())t.s({done:!1,value:v});b.push(v)},throw:(v,t)=>{if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)},return:(v,t)=>{if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)}}),t={[$R[1]]:()=>t,next:(i,t,v)=>{if(d===-1){return((i=c++)>=b.length)?(p.push(t=$R[3]()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],i!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}}})))(($R[4]=($R[5]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),$R[4].next(1),$R[4].next(2),$R[4].next(3),$R[4].return(void 0),$R[4]))},Object.freeze($R[0]),$R[0])($R["example"])"`;

exports[`frozen object > crossSerializeAsync > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=Promise.resolve($R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};if(d=s.v[c=i++],c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}),Object.freeze($R[1]),$R[0])($R["example"])"`;

exports[`frozen object > crossSerializeAsync > scoped > supports self-recursion 1`] = `"($R=>$R[0]={a:$R[1]=Promise.resolve().then(()=>$R[0]),b:$R[2]=Promise.resolve().then(()=>$R[0])},Object.freeze($R[0]),$R[0])($R["example"])"`;

exports[`frozen object > crossSerializeAsync > supports Objects 1`] = `"($R[0]=Promise.resolve($R[1]={hello:"world"}),Object.freeze($R[1]),$R[0])"`;

exports[`frozen object > crossSerializeAsync > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:(($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p),$R[2]=s=>(b,c,p,d,e,t,f)=>(b=[],c=0,p=[],d=-1,e=!1,f=(i,l)=>{for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})},s.on({next:(v,t)=>{if(t=p.shift())t.s({done:!1,value:v});b.push(v)},throw:(v,t)=>{if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)},return:(v,t)=>{if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)}}),t={[$R[1]]:()=>t,next:(i,t,v)=>{if(d===-1){return((i=c++)>=b.length)?(p.push(t=$R[3]()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],c!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}}})))(($R[4]=($R[5]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),$R[4].next(1),$R[4].next(2),$R[4].next(3),$R[4].return(void 0),$R[4]))},Object.freeze($R[0]),$R[0])"`;
exports[`frozen object > crossSerializeAsync > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:(($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p),$R[2]=s=>(b,c,p,d,e,t,f)=>(b=[],c=0,p=[],d=-1,e=!1,f=(i,l)=>{for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})},s.on({next:(v,t)=>{if(t=p.shift())t.s({done:!1,value:v});b.push(v)},throw:(v,t)=>{if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)},return:(v,t)=>{if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)}}),t={[$R[1]]:()=>t,next:(i,t,v)=>{if(d===-1){return((i=c++)>=b.length)?(p.push(t=$R[3]()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],i!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}}})))(($R[4]=($R[5]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),$R[4].next(1),$R[4].next(2),$R[4].next(3),$R[4].return(void 0),$R[4]))},Object.freeze($R[0]),$R[0])"`;

exports[`frozen object > crossSerializeAsync > supports Symbol.iterator 1`] = `"($R[0]=Promise.resolve($R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};if(d=s.v[c=i++],c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}),Object.freeze($R[1]),$R[0])"`;

Expand All @@ -32,7 +32,7 @@ exports[`frozen object > crossSerializeStream > scoped > supports Objects 1`] =

exports[`frozen object > crossSerializeStream > scoped > supports Objects 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status="success",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={hello:"world"}),Object.freeze($R[2]),$R[0])($R["example"])"`;

exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:(($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p),$R[2]=s=>(b,c,p,d,e,t,f)=>(b=[],c=0,p=[],d=-1,e=!1,f=(i,l)=>{for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})},s.on({next:(v,t)=>{if(t=p.shift())t.s({done:!1,value:v});b.push(v)},throw:(v,t)=>{if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)},return:(v,t)=>{if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)}}),t={[$R[1]]:()=>t,next:(i,t,v)=>{if(d===-1){return((i=c++)>=b.length)?(p.push(t=$R[3]()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],c!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}}})))($R[4]=($R[5]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))())},Object.freeze($R[0]),$R[0])($R["example"])"`;
exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:(($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p),$R[2]=s=>(b,c,p,d,e,t,f)=>(b=[],c=0,p=[],d=-1,e=!1,f=(i,l)=>{for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})},s.on({next:(v,t)=>{if(t=p.shift())t.s({done:!1,value:v});b.push(v)},throw:(v,t)=>{if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)},return:(v,t)=>{if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)}}),t={[$R[1]]:()=>t,next:(i,t,v)=>{if(d===-1){return((i=c++)>=b.length)?(p.push(t=$R[3]()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],i!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}}})))($R[4]=($R[5]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))())},Object.freeze($R[0]),$R[0])($R["example"])"`;

exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 2`] = `"($R=>$R[4].next(1))($R["example"])"`;

Expand All @@ -56,7 +56,7 @@ exports[`frozen object > crossSerializeStream > supports Objects 1`] = `"$R[0]=(

exports[`frozen object > crossSerializeStream > supports Objects 2`] = `"(($R[3]=(p,d)=>{p.s(d),p.status="success",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={hello:"world"}),Object.freeze($R[2]),$R[0])"`;

exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:(($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p),$R[2]=s=>(b,c,p,d,e,t,f)=>(b=[],c=0,p=[],d=-1,e=!1,f=(i,l)=>{for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})},s.on({next:(v,t)=>{if(t=p.shift())t.s({done:!1,value:v});b.push(v)},throw:(v,t)=>{if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)},return:(v,t)=>{if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)}}),t={[$R[1]]:()=>t,next:(i,t,v)=>{if(d===-1){return((i=c++)>=b.length)?(p.push(t=$R[3]()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],c!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}}})))($R[4]=($R[5]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))())},Object.freeze($R[0]),$R[0])"`;
exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:(($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p),$R[2]=s=>(b,c,p,d,e,t,f)=>(b=[],c=0,p=[],d=-1,e=!1,f=(i,l)=>{for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})},s.on({next:(v,t)=>{if(t=p.shift())t.s({done:!1,value:v});b.push(v)},throw:(v,t)=>{if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)},return:(v,t)=>{if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)}}),t={[$R[1]]:()=>t,next:(i,t,v)=>{if(d===-1){return((i=c++)>=b.length)?(p.push(t=$R[3]()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],i!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}}})))($R[4]=($R[5]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))())},Object.freeze($R[0]),$R[0])"`;

exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 2`] = `"$R[4].next(1)"`;

Expand Down Expand Up @@ -84,7 +84,7 @@ exports[`frozen object > serialize > supports self-recursion 1`] = `"(h=>(h={},h

exports[`frozen object > serializeAsync > supports Objects 1`] = `"((h,j)=>(j=Promise.resolve(h={hello:"world"}),Object.freeze(h),j))()"`;

exports[`frozen object > serializeAsync > supports Symbol.asyncIterator 1`] = `"((h,j,k,m,o,q)=>(h={[j=Symbol.asyncIterator]:((k=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p),s=>(b,c,p,d,e,t,f)=>(b=[],c=0,p=[],d=-1,e=!1,f=(i,l)=>{for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})},s.on({next:(v,t)=>{if(t=p.shift())t.s({done:!1,value:v});b.push(v)},throw:(v,t)=>{if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)},return:(v,t)=>{if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)}}),t={[j]:()=>t,next:(i,t,v)=>{if(d===-1){return((i=c++)>=b.length)?(p.push(t=k()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],c!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}}})))((q=((b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),q.next(1),q.next(2),q.next(3),q.return(void 0),q))},Object.freeze(h),h))()"`;
exports[`frozen object > serializeAsync > supports Symbol.asyncIterator 1`] = `"((h,j,k,m,o,q)=>(h={[j=Symbol.asyncIterator]:((k=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p),s=>(b,c,p,d,e,t,f)=>(b=[],c=0,p=[],d=-1,e=!1,f=(i,l)=>{for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})},s.on({next:(v,t)=>{if(t=p.shift())t.s({done:!1,value:v});b.push(v)},throw:(v,t)=>{if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)},return:(v,t)=>{if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)}}),t={[j]:()=>t,next:(i,t,v)=>{if(d===-1){return((i=c++)>=b.length)?(p.push(t=k()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],i!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}}})))((q=((b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),q.next(1),q.next(2),q.next(3),q.return(void 0),q))},Object.freeze(h),h))()"`;

exports[`frozen object > serializeAsync > supports Symbol.iterator 1`] = `"((h,j,k,m)=>(m=Promise.resolve(h={[j=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[j]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};if(d=s.v[c=i++],c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})}),Object.freeze(h),m))()"`;

Expand Down
Loading

0 comments on commit e158298

Please sign in to comment.