File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -506,10 +506,11 @@ pub fn (mut d Doc) file_asts(mut file_asts []ast.File) ! {
506506 fname_has_set = true
507507 }
508508 if d.with_head && i == 0 {
509- mut module_name := file_ast.mod.name
510- // if module_name != 'main' && d.parent_mod_name.len > 0 {
511- // module_name = d.parent_mod_name + '.' + module_name
512- // }
509+ mut module_name := if d.parent_mod_name.len > 0 && file_ast.mod.short_name != 'main' {
510+ d.parent_mod_name + '.' + file_ast.mod.short_name
511+ } else {
512+ file_ast.mod.short_name
513+ }
513514 d.head = DocNode{
514515 name: module_name
515516 content: 'module ${module_name} '
Original file line number Diff line number Diff line change @@ -111,21 +111,3 @@ fn unique_server_urls(urls []string) []string {
111111fn normalize_server_url (url string ) string {
112112 return url.trim_space ().trim_string_right ('/' )
113113}
114-
115- fn parse_server_urls (args []string ) []string {
116- mut urls := []string {}
117- mut i := 0
118- for i < args.len {
119- if args[i] in server_url_option_names {
120- i++
121- if i < args.len {
122- url := normalize_server_url (args[i])
123- if url != '' && url ! in urls {
124- urls << url
125- }
126- }
127- }
128- i++
129- }
130- return urls
131- }
Original file line number Diff line number Diff line change @@ -5280,11 +5280,11 @@ fn (mut g Gen) autofree_call_pregen(node ast.CallExpr) {
52805280 } else {
52815281 scope.register (ast.Var{
52825282 name: t
5283- typ: ast.string_type
5283+ typ: arg.typ
52845284 is_autofree_tmp: true
52855285 pos: node.pos
52865286 })
5287- s = 'string ${t} = '
5287+ s = '${g.styp(arg.typ)} ${t} = '
52885288 }
52895289 g.is_autofree_tmp = true
52905290 old_is_autofree := g.is_autofree
Original file line number Diff line number Diff line change @@ -302,8 +302,9 @@ fn (mut g Gen) if_expr(node ast.IfExpr) {
302302 // nested if on return stmt
303303 g.write2 (g.styp (g.unwrap_generic (g.last_if_option_type)), ' ' )
304304 } else if resolved_sym.kind == .function && resolved_sym.info is ast.FnType {
305+ param_types := resolved_sym.info.func.params.map (it .typ)
305306 g.writeln ('${g.fn_var_signature(resolved_typ, resolved_sym.info.func.return_type,
306- resolved_sym.info.func.params.map(it.typ) , tmp)}; /* if prepend */' )
307+ param_types , tmp)}; /* if prepend */' )
307308 declared_tmp = true
308309 } else {
309310 g.write ('${styp} ' )
Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ struct Abc {
66mut volatile zzz := 123
77mut volatile pzzz := &zzz
88println(zzz)
9- println(&int(voidptr(pzzz)))
9+ println(unsafe { &int(voidptr(pzzz)) } )
1010println(Abc{})
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ fn main() {
2828 println(t5)
2929 t6 := typeof(charptr(0))
3030 println(t6)
31- t7 := typeof(&u8(3))
31+ t7 := typeof(unsafe { &u8(3) } )
3232 println(t7)
3333
3434 // functions
You can’t perform that action at this time.
0 commit comments