File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
crates/byondapi-macros/src Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,13 @@ pub fn bind(attr: TokenStream, item: TokenStream) -> TokenStream {
130130 Ok ( val) => val,
131131 Err ( e) => {
132132 let error_string = :: byondapi:: value:: ByondValue :: try_from( :: std:: format!( "{e:?}" ) ) . unwrap( ) ;
133- :: byondapi:: global_call:: call_global_id( byond_string!( "stack_trace" ) , & [ error_string] ) . unwrap( ) ;
133+ :: byondapi:: global_call:: call_global_id( {
134+ static STACK_TRACE : :: std:: sync:: OnceLock <u32 > = :: std:: sync:: OnceLock :: new( ) ;
135+ * STACK_TRACE . get_or_init( || :: byondapi:: byond_string:: str_id_of( "stack_trace" )
136+ . expect( "byondapi-rs implicitly expects stack_trace to exist as a proc for error reporting purposes, this proc doesn't exist!" )
137+ )
138+ }
139+ , & [ error_string] ) . unwrap( ) ;
134140 :: byondapi:: value:: ByondValue :: null( )
135141 }
136142 }
@@ -232,7 +238,13 @@ pub fn bind_raw_args(attr: TokenStream, item: TokenStream) -> TokenStream {
232238 Ok ( val) => val,
233239 Err ( e) => {
234240 let error_string = :: byondapi:: value:: ByondValue :: try_from( :: std:: format!( "{e:?}" ) ) . unwrap( ) ;
235- :: byondapi:: global_call:: call_global_id( byond_string!( "stack_trace" ) , & [ error_string] ) . unwrap( ) ;
241+ :: byondapi:: global_call:: call_global_id( {
242+ static STACK_TRACE : :: std:: sync:: OnceLock <u32 > = :: std:: sync:: OnceLock :: new( ) ;
243+ * STACK_TRACE . get_or_init( || :: byondapi:: byond_string:: str_id_of( "stack_trace" )
244+ . expect( "byondapi-rs implicitly expects stack_trace to exist as a proc for error reporting purposes, this proc doesn't exist!" )
245+ )
246+ }
247+ , & [ error_string] ) . unwrap( ) ;
236248 :: byondapi:: value:: ByondValue :: null( )
237249 }
238250 }
You can’t perform that action at this time.
0 commit comments