1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: fix multiple things and format most of the compiler (#6631)

Format expressions inside string interpolation like the rest (it used to be a+b instead of a + b, not too sure why)
Fix formatting some match branches when there were only one statement inside (it was inlined)
Fix parsing and formatting some comments edge case on struct field init. You should check out this test because the result is a bit different from before. I personally find it more logical but I would understand if the former format was to stay
Fix formatting of void-returning function signature
This commit is contained in:
Enzo
2020-10-15 22:12:59 +02:00
committed by GitHub
parent 23644d92a9
commit b083f4014b
52 changed files with 414 additions and 456 deletions

View File

@@ -58,7 +58,9 @@ pub fn (mut b Builder) compile_c() {
// println(files)
}
$if windows {
b.find_win_cc() or { verror(no_compiler_error) }
b.find_win_cc() or {
verror(no_compiler_error)
}
// TODO Probably extend this to other OS's?
}
// v1 compiler files
@@ -83,7 +85,8 @@ pub fn (mut b Builder) compile_c() {
bundle_id := if b.pref.bundle_id != '' { b.pref.bundle_id } else { 'app.vlang.$bundle_name' }
display_name := if b.pref.display_name != '' { b.pref.display_name } else { bundle_name }
os.mkdir('$display_name\.app')
os.write_file('$display_name\.app/Info.plist', make_ios_plist(display_name, bundle_id, bundle_name, 1))
os.write_file('$display_name\.app/Info.plist', make_ios_plist(display_name, bundle_id,
bundle_name, 1))
}
b.cc()
}

View File

@@ -761,7 +761,7 @@ fn (mut v Builder) build_thirdparty_obj_file(path string, moduleflags []cflag.CF
return
}
println('$obj_path not found, building it...')
cfile := '${path[..path.len-2]}.c'
cfile := '${path[..path.len - 2]}.c'
btarget := moduleflags.c_options_before_target()
atarget := moduleflags.c_options_after_target()
cppoptions := if v.pref.ccompiler.contains('++') { ' -fpermissive -w ' } else { '' }

View File

@@ -5,7 +5,7 @@ import v.table
// generic struct instantiations to concrete types
pub fn (b &Builder) generic_struct_insts_to_concrete() {
for idx, _ in b.table.types {
mut typ := unsafe { &b.table.types[idx] }
mut typ := unsafe {&b.table.types[idx]}
if typ.kind == .generic_struct_inst {
info := typ.info as table.GenericStructInst
parent := b.table.types[info.parent_idx]

View File

@@ -36,4 +36,4 @@ fn make_ios_plist(display_name string, bundle_id string, bundle_name string, bun
</array>
</dict>
</plist>'
}
}

View File

@@ -331,7 +331,7 @@ fn (mut v Builder) build_thirdparty_obj_file_with_msvc(path string, moduleflags
return
}
println('$obj_path not found, building it (with msvc)...')
cfiles := '${path[..path.len-2]}.c'
cfiles := '${path[..path.len - 2]}.c'
flags := msvc_string_flags(moduleflags)
inc_dirs := flags.inc_paths.join(' ')
defines := flags.defines.join(' ')