mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +00:00
LibJS: Unify Symbol::description() and raw_description()
Let callers take care of handling the empty optional case (undefined in the spec).
This commit is contained in:
parent
fcdabd179a
commit
5e72fde954
Notes:
sideshowbarker
2024-07-17 00:30:26 +09:00
Author: https://github.com/linusg
Commit: 5e72fde954
Pull-request: https://github.com/SerenityOS/serenity/pull/17441
Reviewed-by: https://github.com/trflynn89 ✅
5 changed files with 11 additions and 10 deletions
|
@ -87,8 +87,10 @@ JS_DEFINE_NATIVE_FUNCTION(SymbolConstructor::key_for)
|
|||
return vm.throw_completion<TypeError>(ErrorType::NotASymbol, argument.to_string_without_side_effects());
|
||||
|
||||
auto& symbol = argument.as_symbol();
|
||||
if (symbol.is_global())
|
||||
return PrimitiveString::create(vm, symbol.description());
|
||||
if (symbol.is_global()) {
|
||||
// NOTE: Global symbols should always have a description string
|
||||
return PrimitiveString::create(vm, *symbol.description());
|
||||
}
|
||||
|
||||
return js_undefined();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue