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

all: change f mut Foo to mut f Foo

This commit is contained in:
yuyi
2020-06-04 16:35:40 +08:00
committed by GitHub
parent 0b7fe0a9d0
commit 5ae8853648
36 changed files with 62 additions and 65 deletions

View File

@@ -32,7 +32,7 @@ pub mut:
s []Position
}
fn advance(sys mut System, dt f64) {
fn advance(mut sys System, dt f64) {
for i in 0..c_n - 1 {
mut vx := sys.v[i].x
mut vy := sys.v[i].y
@@ -68,7 +68,7 @@ fn advance(sys mut System, dt f64) {
}
}
fn offsetmomentum(sys mut System) {
fn offsetmomentum(mut sys System) {
mut px := f64(0)
mut py := f64(0)
mut pz := f64(0)

View File

@@ -20,7 +20,7 @@ fn hello_response() string {
}
fn callback(req picohttpparser.Request, res mut picohttpparser.Response) {
fn callback(req picohttpparser.Request, mut res picohttpparser.Response) {
if picohttpparser.cmpn(req.method, 'GET ', 4) {
if picohttpparser.cmp(req.path, '/t') {
res.http_ok().header_server().header_date().plain().body(hello_response())

View File

@@ -19,7 +19,7 @@ fn main() {
println('after quick sort whether array is sorted: ${is_sorted(arr)}')
}
fn quick_sort(arr mut []int, l int, r int) {
fn quick_sort(mut arr []int, l int, r int) {
if l>=r { return }
mut sep := l // what is sep: [...all_value<arr[sep]...sep...all_value>=arr[sep]...]
for i in l+1..r+1 {
@@ -34,7 +34,7 @@ fn quick_sort(arr mut []int, l int, r int) {
}
[inline]
fn swap(arr mut []int, i int, j int) {
fn swap(mut arr []int, i int, j int) {
temp := arr[i]
arr[i] = arr[j]
arr[j] = temp

View File

@@ -38,7 +38,7 @@ fn main() {
sapp.run(&desc)
}
fn init(state mut AppState) {
fn init(mut state AppState) {
// dont actually alocate this on the heap in real life
gfx.setup(&C.sg_desc{
mtl_device: sapp.metal_get_device()

View File

@@ -18,7 +18,7 @@ fn evala(i, j int) int {
return ((i + j) * (i + j + 1) / 2 + i + 1)
}
fn times(v mut []f64, u []f64) {
fn times(mut v []f64, u []f64) {
for i in 0..v.len {
mut a := f64(0)
for j in 0..u.len {
@@ -28,7 +28,7 @@ fn times(v mut []f64, u []f64) {
}
}
fn times_trans(v mut []f64, u []f64) {
fn times_trans(mut v []f64, u []f64) {
for i in 0..v.len {
mut a := f64(0)
for j in 0..u.len {
@@ -38,7 +38,7 @@ fn times_trans(v mut []f64, u []f64) {
}
}
fn a_times_transp(v mut []f64, u []f64) {
fn a_times_transp(mut v []f64, u []f64) {
mut x := []f64{len:u.len, init:0}
times(mut x, u)
times_trans(mut v, x)
@@ -69,4 +69,3 @@ fn main() {
ans := math.sqrt(vbv / vv)
println('${ans:0.9f}')
}

View File

@@ -402,7 +402,7 @@ fn parse_binary_tetro(t_ int) []Block {
return res
}
fn on_event(e &sapp.Event, game mut Game) {
fn on_event(e &sapp.Event, mut game Game) {
if e.typ == .key_down {
game.key_down(e.key_code)
}