From 15d45551f274e6fc1beac608af70ca7c3f0bd507 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Sun, 24 Dec 2023 17:08:58 -0500 Subject: [PATCH] avm2: Show FunctionObject name in Debug impl --- core/src/avm2/function.rs | 6 ++++-- core/src/avm2/object/function_object.rs | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/avm2/function.rs b/core/src/avm2/function.rs index 4049ca15cd1f..5dc0fe6ca649 100644 --- a/core/src/avm2/function.rs +++ b/core/src/avm2/function.rs @@ -219,8 +219,10 @@ impl<'gc> Executable<'gc> { } } - pub fn write_full_name(&self, output: &mut WString) { - display_function(output, &self.as_method(), self.bound_superclass()); + pub fn debug_full_name(&self) -> WString { + let mut output = WString::new(); + display_function(&mut output, &self.as_method(), self.bound_superclass()); + output } pub fn num_parameters(&self) -> usize { diff --git a/core/src/avm2/object/function_object.rs b/core/src/avm2/object/function_object.rs index 661bb2317dfb..9a4dafe408e8 100644 --- a/core/src/avm2/object/function_object.rs +++ b/core/src/avm2/object/function_object.rs @@ -65,6 +65,7 @@ impl fmt::Debug for FunctionObject<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("FunctionObject") .field("ptr", &self.0.as_ptr()) + .field("name", &self.0.try_read().map(|r| r.exec.debug_full_name())) .finish() } }