Skip to content

Commit 3611a1c

Browse files
authored
Merge pull request #105 from sunfishcode/sunfishcode/docs
Add subsection headers for the mangling documentation.
2 parents e4d5311 + 3e93c27 commit 3611a1c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

design/mvp/CanonicalABI.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,9 @@ character in a component-level import/export (as is currently the case in `wit`
14291429
[identifiers](WIT.md#identifiers)) and thus can safely be used to prefix
14301430
auxiliary Canonical ABI-induced imports/exports.
14311431

1432-
Instance-mangling recursively builds a dotted path string (of instance names)
1432+
#### Instance type mangling
1433+
1434+
Instance-type mangling recursively builds a dotted path string (of instance names)
14331435
that is included in the mangled core import/export name:
14341436
```python
14351437
def mangle_instances(xs, path = ''):
@@ -1457,7 +1459,9 @@ def mangle_instances(xs, path = ''):
14571459
The three `TODO` cases are intended to be filled in by future PRs extending
14581460
the Canonical ABI.
14591461

1460-
Function and value types are recursively mangled into
1462+
#### Function type mangling
1463+
1464+
Function types are mangled into
14611465
[`wit`](WIT.md)-compatible syntax:
14621466
```python
14631467
def mangle_funcname(name, ft):
@@ -1473,6 +1477,11 @@ def mangle_funcvec(es, pre_space):
14731477
mangled_elems = (e[0] + ': ' + mangle_valtype(e[1]) for e in es)
14741478
return '(' + ', '.join(mangled_elems) + ')'
14751479

1480+
#### Value type mangling
1481+
1482+
Value types are similarly mangled into [`wit`](WIT.md)-compatible syntax,
1483+
recursively:
1484+
14761485
def mangle_valtype(t):
14771486
match t:
14781487
case Bool() : return 'bool'

0 commit comments

Comments
 (0)