mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 10:34:58 +00:00
LibJS: Stop using Optional<Value> in favor of Value's empty state
JS::Value already has the empty state ({} or Value() gives you one.) Use this instead of wrapping Value in Optional in some places. I've also added Value::value_or(Value) so you can easily provide a fallback value when one is not present.
This commit is contained in:
parent
5adf4901df
commit
35aea2e454
14 changed files with 60 additions and 48 deletions
|
@ -151,7 +151,7 @@ void Interpreter::set_variable(const FlyString& name, Value value, bool first_as
|
|||
global_object().put(move(name), move(value));
|
||||
}
|
||||
|
||||
Optional<Value> Interpreter::get_variable(const FlyString& name)
|
||||
Value Interpreter::get_variable(const FlyString& name)
|
||||
{
|
||||
if (m_call_stack.size()) {
|
||||
for (auto* environment = current_environment(); environment; environment = environment->parent()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue