(
&mut self,
kind: wasmparser::ComponentOuterAliasKind,
count: u32,
index: u32,
)
| 1515 | } |
| 1516 | |
| 1517 | fn alias_component_outer( |
| 1518 | &mut self, |
| 1519 | kind: wasmparser::ComponentOuterAliasKind, |
| 1520 | count: u32, |
| 1521 | index: u32, |
| 1522 | ) { |
| 1523 | match kind { |
| 1524 | wasmparser::ComponentOuterAliasKind::CoreType |
| 1525 | | wasmparser::ComponentOuterAliasKind::Type => {} |
| 1526 | |
| 1527 | // For more information about the implementation of outer aliases |
| 1528 | // see the documentation of `LexicalScope`. Otherwise though the |
| 1529 | // main idea here is that the data to close over starts as `Local` |
| 1530 | // and then transitions to `Upvar` as its inserted into the parents |
| 1531 | // in order from target we're aliasing back to the current |
| 1532 | // component. |
| 1533 | wasmparser::ComponentOuterAliasKind::CoreModule => { |
| 1534 | let index = ModuleIndex::from_u32(index); |
| 1535 | let mut module = ClosedOverModule::Local(index); |
| 1536 | let depth = self.lexical_scopes.len() - (count as usize); |
| 1537 | for frame in self.lexical_scopes[depth..].iter_mut() { |
| 1538 | module = ClosedOverModule::Upvar(frame.closure_args.modules.push(module)); |
| 1539 | } |
| 1540 | |
| 1541 | // If the `module` is still `Local` then the `depth` was 0 and |
| 1542 | // it's an alias into our own space. Otherwise it's switched to |
| 1543 | // an upvar and will index into the upvar space. Either way |
| 1544 | // it's just plumbed directly into the initializer. |
| 1545 | self.result |
| 1546 | .initializers |
| 1547 | .push(LocalInitializer::AliasModule(module)); |
| 1548 | } |
| 1549 | wasmparser::ComponentOuterAliasKind::Component => { |
| 1550 | let index = ComponentIndex::from_u32(index); |
| 1551 | let mut component = ClosedOverComponent::Local(index); |
| 1552 | let depth = self.lexical_scopes.len() - (count as usize); |
| 1553 | for frame in self.lexical_scopes[depth..].iter_mut() { |
| 1554 | component = |
| 1555 | ClosedOverComponent::Upvar(frame.closure_args.components.push(component)); |
| 1556 | } |
| 1557 | |
| 1558 | self.result |
| 1559 | .initializers |
| 1560 | .push(LocalInitializer::AliasComponent(component)); |
| 1561 | } |
| 1562 | } |
| 1563 | } |
| 1564 | |
| 1565 | fn canonical_options( |
| 1566 | &mut self, |
no test coverage detected