@@ -10,11 +10,6 @@ const { edit, add } = require("@webassemblyjs/wasm-edit");
1010const { decode } = require ( "@webassemblyjs/wasm-parser" ) ;
1111const t = require ( "@webassemblyjs/ast" ) ;
1212
13- // FIXME(sven): remove this once we're ready to merge
14- function debug ( ...msg ) {
15- // console.log(...msg);
16- }
17-
1813function compose ( ...fns ) {
1914 return fns . reverse ( ) . reduce ( ( prevFn , nextFn ) => {
2015 return value => nextFn ( prevFn ( value ) ) ;
@@ -34,8 +29,6 @@ const initFuncId = t.identifier("__init__");
3429 * @returns {ArrayBuffer } bin'
3530 */
3631const removeStartFunc = state => bin => {
37- debug ( "removeStartFunc" ) ;
38-
3932 return edit ( bin , {
4033 Start ( path ) {
4134 path . remove ( ) ;
@@ -122,8 +115,6 @@ function getNextFuncIndex(ast) {
122115 * @returns {ArrayBuffer } bin'
123116 */
124117const rewriteImportedGlobals = state => bin => {
125- debug ( "rewriteImportedGlobals" ) ;
126-
127118 const newGlobals = [ ] ;
128119
129120 bin = edit ( bin , {
@@ -139,7 +130,6 @@ const rewriteImportedGlobals = state => bin => {
139130 ] )
140131 ) ;
141132
142- debug ( "remove import" , path . node . module , path . node . name ) ;
143133 path . remove ( ) ;
144134 }
145135 }
@@ -163,8 +153,6 @@ const addInitFunction = ({
163153 funcSectionMetadata,
164154 nextFuncIndex
165155} ) => bin => {
166- debug ( "addInitFunction" ) ;
167-
168156 const funcParams = importedGlobals . map ( importedGlobal => {
169157 // used for debugging
170158 const id = t . identifier ( `${ importedGlobal . module } .${ importedGlobal . name } ` ) ;
@@ -183,8 +171,6 @@ const addInitFunction = ({
183171 } , [ ] ) ;
184172
185173 if ( typeof startAtFuncIndex !== "undefined" ) {
186- debug ( "call start func" , startAtFuncIndex . value ) ;
187-
188174 funcBody . push ( t . callInstruction ( startAtFuncIndex ) ) ;
189175 }
190176
@@ -226,11 +212,7 @@ class WebAssemblyGenerator {
226212 } )
227213 ) ;
228214
229- debug ( "__________________________________________________________" ) ;
230215 const newBin = transform ( bin ) ;
231- debug ( "__________________________________________________________" ) ;
232-
233- // console.log(require("@webassemblyjs/wast-printer").print(decode(newBin)));
234216
235217 return new RawSource ( newBin ) ;
236218 }
0 commit comments