diff options
-rw-r--r-- | cmd/hare-gi/emit.ha | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/hare-gi/emit.ha b/cmd/hare-gi/emit.ha index f0b513e..4a9307e 100644 --- a/cmd/hare-gi/emit.ha +++ b/cmd/hare-gi/emit.ha @@ -143,7 +143,7 @@ fn emit_class(ctx: *context, class: *gir::class) (void | io::error) = { push(ctx, class.name); for (let i = 0z; i < len(class.constructors); i += 1) { - emit_constructor(ctx, &class.constructors[i])?; + emit_constructor(ctx, &class.constructors[i], class.name)?; }; for (let i = 0z; i < len(class.methods); i += 1) { emit_method(ctx, &class.methods[i])?; @@ -354,6 +354,7 @@ fn emit_constant(ctx: *context, constant: *gir::constant) (void | io::error) = { fn emit_constructor( ctx: *context, constructor: *gir::constructor, + class_name: str = "", ) (void | io::error) = { if (is_exported(ctx, constructor.c_identifier)) { return; @@ -374,7 +375,11 @@ fn emit_constructor( emit_object(ctx, ctx.glib, "Error")?; }; fmt::fprint(ctx.current.output, ") ")?; - emit_return_value(ctx, constructor.return_value)?; + if (len(class_name) != 0) { + fmt::fprintf(ctx.current.output, "*{}", class_name)?; + } else { + emit_return_value(ctx, constructor.return_value)?; + }; fmt::fprintln(ctx.current.output, ";")?; }; |