Closed Bug 1250714 Opened 9 years ago Closed 9 years ago

Baldr: Empty export name strings are not handled correctly.

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mbx, Unassigned)

References

Details

print(Object.getOwnPropertyNames(wasmEvalText("(module (func (result f32) (f32.const 0x1.91p+2)) (export \"\" 0)(export \"foo\" 0))"))); prints: "foo,prototype,length,name", the "" empty property is missing.
Blocks: wasm
That's intended, at the moment: the empty property means the default export, so that calling the result of wasmEval will just call the default export. The rules we implement are the following: - either the module has no default export, in which case an object is returned. Keys (resp. values) are the exports' names (resp. functions). - or the module has a default export, in which case a function is returned. Then other exports are properties of the returned function. This is what you're seeing in your example. The intent is to work like ES6 modules: `import Module from './mymodule.wasm';` would just bind Module to the default export, whereas `import {named} from './mymodule.wasm';` would bind `named` to the export called "named" in the module.
Ahh, okay, that makes sense. Thanks for the explanation.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.