HackStudio+LibGUI: Remove TextDocument::is_code_document()

The same thing can be accomplished with `is` and `verify_cast`, without
making LibGUI care about HackStudio internals.
This commit is contained in:
Sam Atkins 2023-07-19 19:56:59 +01:00 committed by Sam Atkins
parent 63d14a7e6e
commit d832f3a887
Notes: sideshowbarker 2024-07-17 11:30:54 +09:00
3 changed files with 2 additions and 8 deletions

View File

@ -29,8 +29,6 @@ public:
DeprecatedString const& file_path() const { return m_file_path; }
Optional<Syntax::Language> const& language() const { return m_language; }
virtual bool is_code_document() const override final { return true; }
enum class DiffType {
None,
AddedLine,

View File

@ -456,9 +456,7 @@ Gfx::Bitmap const& Editor::current_position_icon_bitmap()
CodeDocument const& Editor::code_document() const
{
auto const& doc = document();
VERIFY(doc.is_code_document());
return static_cast<CodeDocument const&>(doc);
return verify_cast<CodeDocument const>(document());
}
CodeDocument& Editor::code_document()
@ -471,7 +469,7 @@ void Editor::set_document(GUI::TextDocument& doc)
if (has_document() && &document() == &doc)
return;
VERIFY(doc.is_code_document());
VERIFY(is<CodeDocument>(doc));
GUI::TextEditor::set_document(doc);
set_override_cursor(Gfx::StandardCursor::IBeam);

View File

@ -150,8 +150,6 @@ public:
TextPosition insert_at(TextPosition const&, StringView, Client const* = nullptr);
void remove(TextRange const&);
virtual bool is_code_document() const { return false; }
bool is_empty() const;
bool is_modified() const { return m_undo_stack.is_current_modified(); }
void set_unmodified();