Open
Description
Currently, the name section supports
Name Type | Code | Description |
---|---|---|
Module | 0 | Assigns a name to the module |
Function | 1 | Assigns names to functions |
Local | 2 | Assigns names to locals in functions |
and I am currently updating Binaryen support for these, but found that global names are not supported. I'm not sure if this is already on the roadmap, but in case it isn't, I'd like to propose to extend the binary encoding as follows:
Name Type | Code | Description |
---|---|---|
... | ||
Global | 3 | Assigns names to globals |
Global names
The global names subsection is a name_map
which assigns names to a subset of the global index space (both imports and module-defined).
Each global may be named at most once. Naming a global more than once results in the section being malformed.
To be consistent with function names, global names need not to be unique.
Let me know if this is already being thought of, or if there is more I can do to get globals included.