@@ -310,6 +310,34 @@ Notes:
310
310
independently unique among imports and exports, respectively.
311
311
* URLs are compared for equality by plain byte identity.
312
312
313
+ ## Name Section
314
+
315
+ Like the core wasm [ name
316
+ section] ( https://webassembly.github.io/spec/core/appendix/custom.html#name-section )
317
+ a similar ` name ` custom section is specified here for components to be able to
318
+ name all the declarations that can happen within a component. Similarly like its
319
+ core wasm counterpart validity of this custom section is not required and
320
+ engines should not reject components which have an invalid ` name ` section.
321
+
322
+ ```
323
+ namesec ::= section_0(namedata)
324
+ namedata ::= n:<name> (if n = 'component-name')
325
+ name:<componentnamesubsec>?
326
+ sortnames*:<sortnamesubsec>*
327
+ namesubsection_N(B) ::= N:<byte> size:<u32> B (if size == |B|)
328
+
329
+ componentnamesubsec ::= namesubsection_0(<name>)
330
+ sortnamesubsec ::= namesubsection_1(<sortnames>)
331
+ sortnames ::= sort:<sort> names:<namemap>
332
+
333
+ namemap ::= names:vec(<nameassoc>)
334
+ nameassoc ::= idx:<u32> name:<name>
335
+ ```
336
+
337
+ where ` namemap ` is the same as for core wasm. A particular ` sort ` should only
338
+ appear once within a ` name ` section, for example component instances can only be
339
+ named once.
340
+
313
341
314
342
[ `core:u32` ] : https://webassembly.github.io/spec/core/binary/values.html#integers
315
343
[ `core:section` ] : https://webassembly.github.io/spec/core/binary/modules.html#binary-section
0 commit comments