@@ -78,60 +78,10 @@ export const write = (
7878    is_exception : boolean , 
7979    memory : Memory 
8080)  =>  { 
81-     const  exceptionBit  =  ( is_exception  ? 1  : 0 )  <<  31 ; 
82-     if  ( value  ===  null )  { 
83-         memory . writeUint32 ( kind_ptr ,  exceptionBit  |  Kind . Null ) ; 
84-         return ; 
85-     } 
86- 
87-     const  writeRef  =  ( kind : Kind )  =>  { 
88-         memory . writeUint32 ( kind_ptr ,  exceptionBit  |  kind ) ; 
89-         memory . writeUint32 ( payload1_ptr ,  memory . retain ( value ) ) ; 
90-     } ; 
91- 
92-     const  type  =  typeof  value ; 
93-     switch  ( type )  { 
94-         case  "boolean" : { 
95-             memory . writeUint32 ( kind_ptr ,  exceptionBit  |  Kind . Boolean ) ; 
96-             memory . writeUint32 ( payload1_ptr ,  value  ? 1  : 0 ) ; 
97-             break ; 
98-         } 
99-         case  "number" : { 
100-             memory . writeUint32 ( kind_ptr ,  exceptionBit  |  Kind . Number ) ; 
101-             memory . writeFloat64 ( payload2_ptr ,  value ) ; 
102-             break ; 
103-         } 
104-         case  "string" : { 
105-             writeRef ( Kind . String ) ; 
106-             break ; 
107-         } 
108-         case  "undefined" : { 
109-             memory . writeUint32 ( kind_ptr ,  exceptionBit  |  Kind . Undefined ) ; 
110-             break ; 
111-         } 
112-         case  "object" : { 
113-             writeRef ( Kind . Object ) ; 
114-             break ; 
115-         } 
116-         case  "function" : { 
117-             writeRef ( Kind . Function ) ; 
118-             break ; 
119-         } 
120-         case  "symbol" : { 
121-             writeRef ( Kind . Symbol ) ; 
122-             break ; 
123-         } 
124-         case  "bigint" : { 
125-             writeRef ( Kind . BigInt ) ; 
126-             break ; 
127-         } 
128-         default :
129-             assertNever ( type ,  `Type "${ type }  ) ; 
130-     } 
81+     const  kind  =  writeAndReturnKindBits ( value ,  payload1_ptr ,  payload2_ptr ,  is_exception ,  memory ) ; 
82+     memory . writeUint32 ( kind_ptr ,  kind ) ; 
13183} ; 
13284
133- /// This is a fast version of the above `write` function. 
134- /// Please synchronize with the above `write` function if you change either. 
13585export  const  writeAndReturnKindBits  =  ( 
13686    value : any , 
13787    payload1_ptr : pointer , 
0 commit comments