1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:18:11 +00:00

LibJS: Change ThrowableStringBuilder to privately inherit StringBuilder

Not an issue currently, but while developing, it's easy to miss cases
where an infallible AK::StringBuilder method is still used. By making
this inheritance private, and explicitly pulling in base methods we
can safely use, we get extra help from the compiler to indicate such
mistakes immediately.
This commit is contained in:
Timothy Flynn 2023-02-10 11:02:22 -05:00 committed by Linus Groh
parent 4eebe753d1
commit 7163e4d456

View file

@ -15,7 +15,7 @@
namespace JS {
class ThrowableStringBuilder : public AK::StringBuilder {
class ThrowableStringBuilder : private AK::StringBuilder {
public:
explicit ThrowableStringBuilder(VM&);
@ -25,6 +25,10 @@ public:
ThrowCompletionOr<void> append_code_point(u32 value);
ThrowCompletionOr<String> to_string() const;
using AK::StringBuilder::is_empty;
using AK::StringBuilder::string_view;
using AK::StringBuilder::trim;
private:
VM& m_vm;
};