File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -582,10 +582,7 @@ pub fn parse_program_with(
582582 Span :: new ( 0 , 0 ) ,
583583 ) ) ;
584584 for ( name, ty) in & inferred. globals {
585- let stored = match ty {
586- types:: Ty :: Int | types:: Ty :: Float | types:: Ty :: Bool | types:: Ty :: Str => * ty,
587- _ => types:: Ty :: Object ,
588- } ;
585+ let stored = lower:: Lowerer :: storage ( * ty) ;
589586 declarations. push ( TypedNode :: new (
590587 TypedDeclaration :: Variable ( TypedVariable {
591588 name : intern ( name) ,
Original file line number Diff line number Diff line change @@ -1282,9 +1282,11 @@ impl<'m> Lowerer<'m> {
12821282
12831283 /// A global holds its own scalar type; anything else is stored boxed,
12841284 /// so a list global is one heap header shared by every reader.
1285- fn storage ( ty : Ty ) -> Ty {
1285+ /// How a module variable of type `ty` is stored: primitives,
1286+ /// strings and instances as themselves, the rest boxed.
1287+ pub ( crate ) fn storage ( ty : Ty ) -> Ty {
12861288 match ty {
1287- Ty :: Int | Ty :: Float | Ty :: Bool | Ty :: Str => ty,
1289+ Ty :: Int | Ty :: Float | Ty :: Bool | Ty :: Str | Ty :: Class ( _ ) => ty,
12881290 _ => Ty :: Object ,
12891291 }
12901292 }
You can’t perform that action at this time.
0 commit comments