(ast)
| 464 | |
| 465 | // Apply import/export name changes (after minifying them) |
| 466 | function applyImportAndExportNameChanges(ast) { |
| 467 | const mapping = extraInfo.mapping; |
| 468 | fullWalk(ast, (node) => { |
| 469 | if (isWasmImportsAssign(node)) { |
| 470 | const assignedObject = getWasmImportsValue(node); |
| 471 | assignedObject.properties.forEach((item) => { |
| 472 | if (mapping[item.key.name]) { |
| 473 | item.key.name = mapping[item.key.name]; |
| 474 | } |
| 475 | }); |
| 476 | } else if (node.type === 'AssignmentExpression') { |
| 477 | const value = node.right; |
| 478 | if (isExportUse(value)) { |
| 479 | const name = value.property.value; |
| 480 | if (mapping[name]) { |
| 481 | setLiteralValue(value.property, mapping[name]); |
| 482 | } |
| 483 | } |
| 484 | } else if (node.type === 'CallExpression' && isExportUse(node.callee)) { |
| 485 | // wasmExports["___wasm_call_ctors"](); -> wasmExports["M"](); |
| 486 | const callee = node.callee; |
| 487 | const name = callee.property.value; |
| 488 | if (mapping[name]) { |
| 489 | setLiteralValue(callee.property, mapping[name]); |
| 490 | } |
| 491 | } else if (isExportUse(node)) { |
| 492 | const prop = node.property; |
| 493 | const name = prop.value; |
| 494 | if (mapping[name]) { |
| 495 | setLiteralValue(prop, mapping[name]); |
| 496 | } |
| 497 | } |
| 498 | }); |
| 499 | } |
| 500 | |
| 501 | // A static dyncall is dynCall('vii', ..), which is actually static even |
| 502 | // though we call dynCall() - we see the string signature statically. |
nothing calls this directly
no test coverage detected