Fix panic when accessing a global from init that's not used otherwise

Make sure to visit the named references in the init code, when
collecting globals.

Fixes #2312
This commit is contained in:
Simon Hausmann 2023-03-02 10:43:55 +01:00 committed by Simon Hausmann
parent fb06cd8d51
commit f4c30ce46e
2 changed files with 8 additions and 0 deletions

View file

@ -2056,6 +2056,11 @@ pub fn visit_all_named_references(
compo
},
);
component
.init_code
.borrow_mut()
.iter_mut()
.for_each(|expr| visit_named_references_in_expression(expr, vis));
}
/// Visit all expression in this component and sub components