(metadata, function_exports, other_exports, library_symbols, aliases)
| 1083 | |
| 1084 | |
| 1085 | def create_module(metadata, function_exports, other_exports, library_symbols, aliases): |
| 1086 | module = [] |
| 1087 | module.append(create_receiving(function_exports, other_exports, library_symbols, aliases)) |
| 1088 | |
| 1089 | sending = create_sending(metadata, library_symbols) |
| 1090 | if settings.WASM_ESM_INTEGRATION: |
| 1091 | module.append(sending) |
| 1092 | else: |
| 1093 | if settings.PTHREADS or settings.WASM_WORKERS or (settings.IMPORTED_MEMORY and settings.MODULARIZE == 'instance'): |
| 1094 | sending = textwrap.indent(sending, ' ').strip() |
| 1095 | module.append('''\ |
| 1096 | var wasmImports; |
| 1097 | function assignWasmImports() { |
| 1098 | wasmImports = %s; |
| 1099 | }''' % sending) |
| 1100 | else: |
| 1101 | module.append('var wasmImports = %s;' % sending) |
| 1102 | |
| 1103 | if settings.SUPPORT_LONGJMP == 'emscripten' or not settings.DISABLE_EXCEPTION_CATCHING: |
| 1104 | module += create_invoke_wrappers(metadata) |
| 1105 | else: |
| 1106 | assert not metadata.invoke_funcs, "invoke_ functions exported but exceptions and longjmp are both disabled" |
| 1107 | |
| 1108 | if settings.MEMORY64 or settings.CAN_ADDRESS_2GB: |
| 1109 | module.append(create_pointer_conversion_wrappers(metadata)) |
| 1110 | |
| 1111 | if settings.WASM_ESM_INTEGRATION: |
| 1112 | module.append(create_reexports(metadata)) |
| 1113 | |
| 1114 | module = [chunk for chunk in module if chunk] |
| 1115 | return '\n\n'.join(module) + '\n' |
| 1116 | |
| 1117 | |
| 1118 | def create_invoke_wrappers(metadata): |
no test coverage detected