From 2ae2245144bd0e74a76d45caeebc0e6d90a404f0 Mon Sep 17 00:00:00 2001 From: Alexey Yerin Date: Wed, 4 Oct 2023 21:11:22 +0300 Subject: Fix subtyping of classes --- cmd/demo/main.ha | 27 +++++++++++++-------------- cmd/hare-gi/emit.ha | 3 --- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/cmd/demo/main.ha b/cmd/demo/main.ha index 0926134..af7c60c 100644 --- a/cmd/demo/main.ha +++ b/cmd/demo/main.ha @@ -7,40 +7,39 @@ use rt; use types::c; fn about_clicked(btn: *gtk::Button, data: *opaque) void = { - let dialog = gtk::about_dialog_new(); + let dialog = gtk::about_dialog_new(): *gtk::AboutDialog; const authors: []*c::char = [ c::fromstr("Harriet?"), null: *c::char, ]; gtk::about_dialog_set_license_type( - dialog: *gtk::AboutDialog, + dialog, gtk::License::MPL_2_0, ); gtk::about_dialog_set_authors( - dialog: *gtk::AboutDialog, + dialog, authors: *[*]*c::char: **c::char, ); gtk::about_dialog_set_website( - dialog: *gtk::AboutDialog, + dialog, c::fromstr("https://git.sr.ht/~yerinalexey/hare-gi"), ); - gtk::widget_show_all(dialog); }; fn activate(app: *gio::Application, data: *opaque) void = { const app = app: *gtk::Application; - let button = gtk::button_new_with_label(c::fromstr("About")); - gtk::button_connect_clicked(button: *gtk::Button, &about_clicked, null); + let button = gtk::button_new_with_label(c::fromstr("About")): *gtk::Button; + gtk::button_connect_clicked(button, &about_clicked, null); - let headerbar = gtk::header_bar_new(); - gtk::header_bar_set_title(headerbar: *gtk::HeaderBar, c::fromstr("hare-gi demo")); - gtk::header_bar_set_show_close_button(headerbar: *gtk::HeaderBar, glib::TRUE); - gtk::header_bar_pack_end(headerbar: *gtk::HeaderBar, button); + let headerbar = gtk::header_bar_new(): *gtk::HeaderBar; + gtk::header_bar_set_title(headerbar, c::fromstr("hare-gi demo")); + gtk::header_bar_set_show_close_button(headerbar, glib::TRUE); + gtk::header_bar_pack_end(headerbar, button); - let window = gtk::application_window_new(app); - gtk::window_set_titlebar(window: *gtk::Window, headerbar); + let window = gtk::application_window_new(app): *gtk::ApplicationWindow; + gtk::window_set_titlebar(window, headerbar); gtk::widget_show_all(window); }; @@ -48,7 +47,7 @@ export fn main() void = { let app = gtk::application_new( c::fromstr("hare_gi.example"), gio::ApplicationFlags::FLAGS_NONE, - ): *gio::Application; + ): *gtk::Application; gio::application_connect_activate(app, &activate, null); const status = gio::application_run( app, rt::argc: int, rt::argv: **c::char, diff --git a/cmd/hare-gi/emit.ha b/cmd/hare-gi/emit.ha index cf0ecce..3e3f0c4 100644 --- a/cmd/hare-gi/emit.ha +++ b/cmd/hare-gi/emit.ha @@ -523,9 +523,6 @@ fn emit_field(ctx: *context, field: *gir::field) (void | io::error) = { emit_indented_doc(ctx, field)?; fmt::fprintf(ctx.current.output, "\t" "{}: ", fix_identifier(field.name))?; - if (!field.writable) { - fmt::fprint(ctx.current.output, "const ")?; - }; emit_type(ctx, field.type_)?; fmt::fprintln(ctx.current.output, ",")?; }; -- cgit 1.3.0-6-gf8a5