1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:37:34 +00:00

LibJS: Convert to_number() to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-10-17 23:20:05 +03:00
parent a36ee213b9
commit 20d990563c
22 changed files with 149 additions and 343 deletions

View file

@ -50,7 +50,7 @@ JS::Value NumericCell::js_value(Cell& cell, const CellTypeMetadata&) const
cell.set_exception(exc);
}
} };
return cell.js_data().to_number(cell.sheet().global_object());
return TRY_OR_DISCARD(cell.js_data().to_number(cell.sheet().global_object()));
}
}

View file

@ -352,9 +352,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_arithmetic)
auto& column_name_str = column_name.as_string().string();
auto offset = vm.argument(1).to_number(global_object);
if (!offset.is_number())
return {};
auto offset = TRY_OR_DISCARD(vm.argument(1).to_number(global_object));
auto offset_number = offset.as_i32();