fmt: fix alignment of struct init fields (#22025)

This commit is contained in:
yuyi 2024-08-11 14:11:24 +08:00 committed by GitHub
parent 99da5726db
commit c51d30bf53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
671 changed files with 18817 additions and 18787 deletions

View file

@ -154,7 +154,7 @@ pub fn (mut expr ConstExpression) ref_func(name string) {
expr.code << 0xD2 // ref.func
expr.call_patches << FunctionCallPatch{
name: name
pos: expr.code.len
pos: expr.code.len
}
}
@ -164,8 +164,8 @@ pub fn (mut expr ConstExpression) ref_func(name string) {
pub fn (mut expr ConstExpression) ref_func_import(mod string, name string) {
expr.code << 0xD2 // ref.func
expr.call_patches << ImportCallPatch{
mod: mod
mod: mod
name: name
pos: expr.code.len
pos: expr.code.len
}
}

View file

@ -101,7 +101,7 @@ pub fn (mut func Function) new_local(v ValType) LocalIndex {
pub fn (mut func Function) new_local_named(v ValType, name string) LocalIndex {
ret := func.locals.len
func.locals << FunctionLocal{
typ: v
typ: v
name: name
}
return ret
@ -991,7 +991,7 @@ pub fn (mut func Function) call(name string) {
func.code << 0x10 // call
func.patches << CallPatch(FunctionCallPatch{
name: name
pos: func.code.len
pos: func.code.len
})
}
@ -1001,9 +1001,9 @@ pub fn (mut func Function) call(name string) {
pub fn (mut func Function) call_import(mod string, name string) {
func.code << 0x10 // call
func.patches << CallPatch(ImportCallPatch{
mod: mod
mod: mod
name: name
pos: func.code.len
pos: func.code.len
})
}
@ -1198,7 +1198,7 @@ pub fn (mut func Function) ref_func(name string) {
func.code << 0xD2 // ref.func
func.patches << CallPatch(FunctionCallPatch{
name: name
pos: func.code.len
pos: func.code.len
})
}
@ -1208,8 +1208,8 @@ pub fn (mut func Function) ref_func(name string) {
pub fn (mut func Function) ref_func_import(mod string, name string) {
func.code << 0xD2 // ref.func
func.patches << CallPatch(ImportCallPatch{
mod: mod
mod: mod
name: name
pos: func.code.len
pos: func.code.len
})
}

View file

@ -140,10 +140,10 @@ pub fn (mut mod Module) new_function(name string, parameters []ValType, results
tidx := mod.new_functype(FuncType{parameters, results, none})
return Function{
name: name
tidx: tidx
idx: idx
mod: mod
name: name
tidx: tidx
idx: idx
mod: mod
locals: parameters.map(FunctionLocal{}) // specifying it's ValType doesn't matter
}
}
@ -158,10 +158,10 @@ pub fn (mut mod Module) new_debug_function(name string, typ FuncType, argument_n
tidx := mod.new_functype(typ)
return Function{
name: name
tidx: tidx
idx: idx
mod: mod
name: name
tidx: tidx
idx: idx
mod: mod
locals: argument_names.map(FunctionLocal{ name: it }) // specifying it's ValType doesn't matter
}
}
@ -175,10 +175,10 @@ pub fn (mut mod Module) enable_debug(mod_name ?string) {
// assign_memory assigns memory to the current module.
pub fn (mut mod Module) assign_memory(name string, export bool, min u32, max ?u32) {
mod.memory = Memory{
name: name
name: name
export: export
min: min
max: max
min: min
max: max
}
}
@ -194,7 +194,7 @@ pub fn (mut mod Module) new_function_import(modn string, name string, parameters
tidx := mod.new_functype(FuncType{parameters, results, none})
mod.fn_imports << FunctionImport{
mod: modn
mod: modn
name: name
tidx: tidx
}
@ -207,7 +207,7 @@ pub fn (mut mod Module) new_function_import_debug(modn string, name string, typ
tidx := mod.new_functype(typ)
mod.fn_imports << FunctionImport{
mod: modn
mod: modn
name: name
tidx: tidx
}
@ -228,7 +228,7 @@ pub fn (mut mod Module) commit(func Function, export bool) {
pub fn (mut mod Module) new_data_segment(name ?string, pos int, data []u8) DataSegmentIndex {
len := mod.segments.len
mod.segments << DataSegment{
idx: pos
idx: pos
data: data
name: name
}
@ -249,11 +249,11 @@ pub fn (mut mod Module) new_passive_data_segment(name ?string, data []u8) {
pub fn (mut mod Module) new_global(name string, export bool, typ ValType, is_mut bool, init ConstExpression) GlobalIndex {
len := mod.globals.len
mod.globals << Global{
typ: typ
typ: typ
is_mut: is_mut
name: name
name: name
export: export
init: init
init: init
}
return len
}
@ -265,9 +265,9 @@ pub fn (mut mod Module) new_global_import(modn string, name string, typ ValType,
len := mod.global_imports.len
mod.global_imports << GlobalImport{
mod: modn
name: name
typ: typ
mod: modn
name: name
typ: typ
is_mut: is_mut
}
return len