1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibJS: Make ExecutionContext::function_name a GCPtr<PrimitiveString>

This required setting things up so that all function objects can plop
a PrimitiveString there instead of an AK string.

This is a step towards making ExecutionContext easier to allocate.
This commit is contained in:
Andreas Kling 2023-11-27 13:38:19 +01:00
parent eda2a6d9f7
commit 845da3901d
9 changed files with 34 additions and 16 deletions

View file

@ -142,9 +142,9 @@ ThrowCompletionOr<Value> Console::trace()
// NOTE: -2 to skip the console.trace() execution context
for (ssize_t i = execution_context_stack.size() - 2; i >= 0; --i) {
auto const& function_name = execution_context_stack[i]->function_name;
trace.stack.append(function_name.is_empty()
trace.stack.append((!function_name || function_name->is_empty())
? "<anonymous>"_string
: TRY_OR_THROW_OOM(vm, String::from_deprecated_string(function_name)));
: function_name->utf8_string());
}
// 2. Optionally, let formattedData be the result of Formatter(data), and incorporate formattedData as a label for trace.