MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / parse_wasm

Method parse_wasm

test/common.py:703–724  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

701 os.environ['EMCC_TEMP_DIR'] = self.temp_dir
702
703 def parse_wasm(self, filename):
704 wat = self.get_wasm_text(filename)
705 imports = []
706 exports = []
707 funcs = []
708 for line in wat.splitlines():
709 line = line.strip()
710 if line.startswith('(import '):
711 line = line.strip('()')
712 parts = line.split()
713 module = parts[1].strip('"')
714 name = parts[2].strip('"')
715 imports.append('%s.%s' % (module, name))
716 if line.startswith('(export '):
717 line = line.strip('()')
718 name = line.split()[1].strip('"')
719 exports.append(name)
720 if line.startswith('(func '):
721 line = line.strip('()')
722 name = line.split()[1].strip('"')
723 funcs.append(name)
724 return imports, exports, funcs
725
726 def output_name(self, basename):
727 suffix = get_output_suffix(self.get_cflags())

Callers 3

run_codesize_testMethod · 0.80

Calls 3

get_wasm_textMethod · 0.95
splitMethod · 0.80
appendMethod · 0.80

Tested by 3

run_codesize_testMethod · 0.64