fmt: keep any langauge prefix variations in struct fields (#7534)

pull/7540/head
Lukas Neubert 2020-12-24 12:36:54 +01:00 committed by GitHub
parent e5d3aa916d
commit 691e6f9d3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -622,7 +622,7 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl) {
max = comments_len + field.name.len
}
mut ft := f.no_cur_mod(f.table.type_to_str(field.typ))
if !ft.starts_with('C.') && !ft.starts_with('JS.') {
if !ft.contains('C.') && !ft.contains('JS.') {
ft = f.short_module(ft)
}
field_types << ft

View File

@ -1,5 +1,12 @@
import os
struct KeepAnyLanguagePrefixVariation {
x C.bar
y &C.bar
z []C.bar
z2 []&C.bar
}
fn foo(a []os.File) {
}