Skip to content

Commit fd086c3

Browse files
committed
feat: converted signals to V types
1 parent 3cba541 commit fd086c3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

generator/generator.v

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,17 +388,23 @@ fn (mut g Generator) gen_signals() ! {
388388
mut clause := 'if f is ${sig_name} {'
389389
mut arg_list := []string{cap: signal.arguments.len}
390390
for a, arg in signal.arguments {
391-
type := convert_type(arg.type)
391+
type := convert_strings(convert_type(arg.type))
392392
match type {
393393
'bool' {
394394
clause += '\n| arg${a} := unsafe { args[${a}].to_bool() }'
395395
}
396+
'string' {
397+
clause += '\n| arg${a} := unsafe { args[${a}].to_string() }'
398+
}
396399
'i64' {
397400
clause += '\n| arg${a} := unsafe { args[${a}].to_i64() }'
398401
}
399402
'f64' {
400403
clause += '\n| arg${a} := unsafe { args[${a}].to_f64() }'
401404
}
405+
'Variant' {
406+
clause += '\n| arg${a} := unsafe { args[${a}] }'
407+
}
402408
else {
403409
clause += '\n| arg${a} := unsafe { ${type}.from_variant(args[${a}]) }'
404410
}

generator/helpers.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct SignatureCfg {
4747
fn signature(args []APIArg, cfg SignatureCfg) (string, string) {
4848
ret_sig := ' ${cfg.return}'.trim_space_right()
4949
args_sig := args.map(fn [cfg] (arg APIArg) string {
50-
type := convert_type(arg.type)
50+
type := convert_strings(convert_type(arg.type))
5151
if cfg.strip_names {
5252
return type
5353
}

0 commit comments

Comments
 (0)