@@ -4,15 +4,18 @@ use compiler_global_scope::key::EntryKey;
44use compiler_typing:: { TypedGlobalScope , TypedGlobalScopeEntry , raw:: RawType , tree:: Type } ;
55use diagnostics:: { DiagnosticResult , DiagnosticSpanOrigin } ;
66
7- use crate :: { ctx:: HIRFunction , nodes:: HIRNode } ;
7+ use crate :: {
8+ ctx:: { HIRBranchedContext , HIRFunction , HIRFunctionImpl } ,
9+ nodes:: HIRNode ,
10+ } ;
811
912/// The HIR version of `GlobalScopeStorage`. Contains the descriptors and implementations.
1013/// Every function to append, gather will automatically handle descriptors and implementations if needed
1114#[ derive( Debug ) ]
1215pub struct HIRGlobalScopeStorage {
1316 pub scope : TypedGlobalScope ,
1417 pub descriptors : Vec < HIRFunction > ,
15- pub implementations : Vec < Box < HIRNode > > ,
18+ pub implementations : Vec < HIRFunctionImpl > ,
1619}
1720
1821impl HIRGlobalScopeStorage {
@@ -39,10 +42,11 @@ impl HIRGlobalScopeStorage {
3942 name : EntryKey ,
4043 descriptor : HIRFunction ,
4144 implementation : Box < HIRNode > ,
45+ brctx : HIRBranchedContext ,
4246 origin : & K ,
4347 ) -> DiagnosticResult < usize > {
4448 self . descriptors . push ( descriptor) ;
45- self . implementations . push ( implementation) ;
49+ self . implementations . push ( ( brctx , implementation) ) ;
4650
4751 self . scope . append (
4852 name,
@@ -74,11 +78,12 @@ impl HIRGlobalScopeStorage {
7478 name : EntryKey ,
7579 descriptor : HIRFunction ,
7680 implementation : Box < HIRNode > ,
81+ brctx : HIRBranchedContext ,
7782 struct_type : RawType ,
7883 origin : & K ,
7984 ) -> DiagnosticResult < usize > {
8085 self . descriptors . push ( descriptor) ;
81- self . implementations . push ( implementation) ;
86+ self . implementations . push ( ( brctx , implementation) ) ;
8287
8388 let ind = self . scope . value_to_ind [ & TypedGlobalScopeEntry :: Type ( struct_type) ] ;
8489
@@ -151,7 +156,7 @@ impl HIRGlobalScopeStorage {
151156 & self ,
152157 name : EntryKey ,
153158 origin : & K ,
154- ) -> DiagnosticResult < Box < HIRNode > > {
159+ ) -> DiagnosticResult < HIRFunctionImpl > {
155160 let ind = self . scope . get_function_impl ( name, origin) ?;
156161
157162 return Ok ( self . implementations [ ind] . clone ( ) ) ;
@@ -171,7 +176,7 @@ impl HIRGlobalScopeStorage {
171176 & self ,
172177 name : EntryKey ,
173178 origin : & K ,
174- ) -> DiagnosticResult < ( HIRFunction , Box < HIRNode > ) > {
179+ ) -> DiagnosticResult < ( HIRFunction , HIRFunctionImpl ) > {
175180 let inds = self . scope . get_exact_function ( name, origin) ?;
176181
177182 return Ok ( (
@@ -184,7 +189,7 @@ impl HIRGlobalScopeStorage {
184189 & self ,
185190 name : EntryKey ,
186191 origin : & K ,
187- ) -> DiagnosticResult < ( HIRFunction , Box < HIRNode > , RawType ) > {
192+ ) -> DiagnosticResult < ( HIRFunction , HIRFunctionImpl , RawType ) > {
188193 let res = self . scope . get_exact_struct_function ( name, origin) ?;
189194
190195 return Ok ( (
0 commit comments