@@ -202,8 +202,6 @@ const rewriteExportNames = ({ ast, module }) => bin => {
202202 const usedName = module . isUsed ( path . node . name ) ;
203203 if ( usedName ) {
204204 path . node . name = usedName ;
205- // TODO remove this when fixed in @webassemblyjs
206- path . node . descr . id = t . numberLiteral ( + path . node . descr . id . raw ) ;
207205 } else {
208206 path . remove ( ) ;
209207 }
@@ -229,10 +227,6 @@ const rewriteImports = ({ ast, usedDependencyMap }) => bin => {
229227 } else {
230228 path . node . module = WebAssemblyUtils . MANGLED_MODULE ;
231229 path . node . name = result . name ;
232- if ( path . node . descr . id )
233- path . node . descr . id = t . numberLiteral ( + path . node . descr . id . raw ) ;
234- if ( path . node . descr . name )
235- path . node . descr . name = t . numberLiteral ( + path . node . descr . name . raw ) ;
236230 }
237231 }
238232 } ) ;
@@ -284,19 +278,20 @@ const addInitFunction = ({
284278 const funcResults = [ ] ;
285279
286280 // Code section
287- const func = t . func ( initFuncId , funcParams , funcResults , funcBody ) ;
281+ const funcSignature = t . signature ( funcParams , funcResults ) ;
282+ const func = t . func ( initFuncId , funcSignature , funcBody ) ;
288283
289284 // Type section
290- const functype = t . typeInstructionFunc (
291- func . signature . params ,
292- func . signature . results
293- ) ;
285+ const functype = t . typeInstruction ( undefined , funcSignature ) ;
294286
295287 // Func section
296288 const funcindex = t . indexInFuncSection ( nextTypeIndex ) ;
297289
298290 // Export section
299- const moduleExport = t . moduleExport ( initFuncId . value , "Func" , nextFuncIndex ) ;
291+ const moduleExport = t . moduleExport (
292+ initFuncId . value ,
293+ t . moduleExportDescr ( "Func" , nextFuncIndex )
294+ ) ;
300295
301296 return addWithAST ( ast , bin , [ func , moduleExport , funcindex , functype ] ) ;
302297} ;
@@ -330,7 +325,8 @@ class WebAssemblyGenerator extends Generator {
330325
331326 const ast = decode ( bin , {
332327 ignoreDataSection : true ,
333- ignoreCodeSection : true
328+ ignoreCodeSection : true ,
329+ ignoreCustomNameSection : true
334330 } ) ;
335331
336332 const importedGlobals = getImportedGlobals ( ast ) ;
0 commit comments