mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:17:46 +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
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