@@ -1101,12 +1101,23 @@ export function decode(ab: ArrayBuffer, opts: DecoderOpts): Program {
11011101 return t . globalType ( type , globalType ) ;
11021102 }
11031103
1104- function parseNameModule ( ) {
1105- const name = readUTF8String ( ) ;
1106- eatBytes ( name . nextIndex ) ;
1104+ // function parseNameModule() {
1105+ // const lenu32 = readVaruint32 ();
1106+ // eatBytes(lenu32 .nextIndex);
11071107
1108- return [ t . moduleNameMetadata ( name . value ) ] ;
1109- }
1108+ // console.log("len", lenu32);
1109+
1110+ // const strlen = lenu32.value;
1111+
1112+ // dump([strlen], "string length");
1113+
1114+ // const bytes = readBytes(strlen);
1115+ // eatBytes(strlen);
1116+
1117+ // const value = utf8.decode(bytes);
1118+
1119+ // return [t.moduleNameMetadata(value)];
1120+ // }
11101121
11111122 // this section contains an array of function names and indices
11121123 function parseNameSectionFunctions ( ) {
@@ -1178,10 +1189,16 @@ export function decode(ab: ArrayBuffer, opts: DecoderOpts): Program {
11781189 eatBytes ( subSectionSizeInBytesu32 . nextIndex ) ;
11791190
11801191 switch ( sectionTypeByte . value ) {
1181- case 0 : {
1182- nameMetadata. push ( ...parseNameModule ( ) ) ;
1183- break ;
1184- }
1192+ // case 0: {
1193+ // TODO(sven): re-enable that
1194+ // Current status: it seems that when we decode the module's name
1195+ // no name_payload_len is used.
1196+ //
1197+ // See https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#name-section
1198+ //
1199+ // nameMetadata.push(...parseNameModule());
1200+ // break;
1201+ // }
11851202 case 1 : {
11861203 nameMetadata. push ( ...parseNameSectionFunctions ( ) ) ;
11871204 break ;
0 commit comments