فهرست منبع

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.
Timothy Flynn 2 سال پیش
والد
کامیت
7163e4d456
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.h

+ 5 - 1
Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.h

@@ -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;
 };