fmt: remove inline comments (#19263)

This commit is contained in:
yuyi 2023-09-04 04:51:56 +08:00 committed by GitHub
parent 3d2731fca7
commit 18e60e77de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 951 additions and 1034 deletions

View file

@ -6,7 +6,7 @@ import v.util
const (
known_failing_exceptions = [
'vlib/crypto/aes/const.v' /* const array wrapped in too many lines */,
'vlib/crypto/aes/const.v', // const array wrapped in too many lines
]
)

View file

@ -85,13 +85,13 @@ const (
]
skip_test_files = [
'do_not_remove',
'cmd/tools/vdoc/html_tag_escape_test.v', /* can't locate local module: markdown */
'cmd/tools/vdoc/tests/vdoc_file_test.v', /* fails on Windows; order of output is not as expected */
'vlib/context/deadline_test.v' /* sometimes blocks */,
'vlib/context/onecontext/onecontext_test.v' /* backtrace_symbols is missing. */,
'vlib/db/mysql/mysql_orm_test.v' /* mysql not installed */,
'vlib/db/mysql/mysql_test.v' /* mysql not installed */,
'vlib/db/pg/pg_orm_test.v' /* pg not installed */,
'cmd/tools/vdoc/html_tag_escape_test.v', // can't locate local module: markdown
'cmd/tools/vdoc/tests/vdoc_file_test.v', // fails on Windows; order of output is not as expected
'vlib/context/deadline_test.v', // sometimes blocks
'vlib/context/onecontext/onecontext_test.v', // backtrace_symbols is missing
'vlib/db/mysql/mysql_orm_test.v', // mysql not installed
'vlib/db/mysql/mysql_test.v', // mysql not installed
'vlib/db/pg/pg_orm_test.v', // pg not installed
]
// These tests are too slow to be run in the CI on each PR/commit
// in the sanitized modes:

View file

@ -54,17 +54,17 @@ const (
game_over_color: gx.rgb(190, 50, 50)
text_color: gx.black
tile_colors: [
gx.rgb(205, 193, 180), /* Empty / 0 tile */
gx.rgb(238, 228, 218), /* 2 */
gx.rgb(237, 224, 200), /* 4 */
gx.rgb(242, 177, 121), /* 8 */
gx.rgb(245, 149, 99), /* 16 */
gx.rgb(246, 124, 95), /* 32 */
gx.rgb(246, 94, 59), /* 64 */
gx.rgb(237, 207, 114), /* 128 */
gx.rgb(237, 204, 97), /* 256 */
gx.rgb(237, 200, 80), /* 512 */
gx.rgb(237, 197, 63), /* 1024 */
gx.rgb(205, 193, 180), // Empty / 0 tile
gx.rgb(238, 228, 218), // 2
gx.rgb(237, 224, 200), // 4
gx.rgb(242, 177, 121), // 8
gx.rgb(245, 149, 99), // 16
gx.rgb(246, 124, 95), // 32
gx.rgb(246, 94, 59), // 64
gx.rgb(237, 207, 114), // 128
gx.rgb(237, 204, 97), // 256
gx.rgb(237, 200, 80), // 512
gx.rgb(237, 197, 63), // 1024
gx.rgb(237, 194, 46),
]
},

View file

@ -173,63 +173,63 @@ const (
e: Vec{}
c: Vec{.75, .25, .25}
refl: .diff
}, /* Left */
}, // Left
Sphere{
rad: 1e+5
p: Vec{-1e+5 + 99, 40.8, 81.6}
e: Vec{}
c: Vec{.25, .25, .75}
refl: .diff
}, /* Rght */
}, // Rght
Sphere{
rad: 1e+5
p: Vec{50, 40.8, 1e+5}
e: Vec{}
c: Vec{.75, .75, .75}
refl: .diff
}, /* Back */
}, // Back
Sphere{
rad: 1e+5
p: Vec{50, 40.8, -1e+5 + 170}
e: Vec{}
c: Vec{}
refl: .diff
}, /* Frnt */
}, // Frnt
Sphere{
rad: 1e+5
p: Vec{50, 1e+5, 81.6}
e: Vec{}
c: Vec{.75, .75, .75}
refl: .diff
}, /* Botm */
}, // Botm
Sphere{
rad: 1e+5
p: Vec{50, -1e+5 + 81.6, 81.6}
e: Vec{}
c: Vec{.75, .75, .75}
refl: .diff
}, /* Top */
}, // Top
Sphere{
rad: 16.5
p: Vec{27, 16.5, 47}
e: Vec{}
c: Vec{1, 1, 1}.mult_s(.999)
refl: .spec
}, /* Mirr */
}, // Mirr
Sphere{
rad: 16.5
p: Vec{73, 16.5, 78}
e: Vec{}
c: Vec{1, 1, 1}.mult_s(.999)
refl: .refr
}, /* Glas */
}, // Glas
Sphere{
rad: 600
p: Vec{50, 681.6 - .27, 81.6}
e: Vec{12, 12, 12}
c: Vec{}
refl: .diff
} /* Lite */,
}, // Lite
],
[// scene 1 sunset
Sphere{
@ -238,63 +238,63 @@ const (
e: Vec{1.0, .9, .8}.mult_s(1.2e+1 * 1.56 * 2)
c: Vec{}
refl: .diff
}, /* sun */
}, // sun
Sphere{
rad: 1560
p: Vec{1, 0, 2}.mult_s(3500)
e: Vec{1.0, .5, .05}.mult_s(4.8e+1 * 1.56 * 2)
c: Vec{}
refl: .diff
}, /* horizon sun2 */
}, // horizon sun2
Sphere{
rad: 10000
p: cen + Vec{0, 0, -200}
e: Vec{0.00063842, 0.02001478, 0.28923243}.mult_s(6e-2 * 8)
c: Vec{.7, .7, 1}.mult_s(.25)
refl: .diff
}, /* sky */
}, // sky
Sphere{
rad: 100000
p: Vec{50, -100000, 0}
e: Vec{}
c: Vec{.3, .3, .3}
refl: .diff
}, /* grnd */
}, // grnd
Sphere{
rad: 110000
p: Vec{50, -110048.5, 0}
e: Vec{.9, .5, .05}.mult_s(4)
c: Vec{}
refl: .diff
}, /* horizon brightener */
}, // horizon brightener
Sphere{
rad: 4e+4
p: Vec{50, -4e+4 - 30, -3000}
e: Vec{}
c: Vec{.2, .2, .2}
refl: .diff
}, /* mountains */
}, // mountains
Sphere{
rad: 26.5
p: Vec{22, 26.5, 42}
e: Vec{}
c: Vec{1, 1, 1}.mult_s(.596)
refl: .spec
}, /* white Mirr */
}, // white Mirr
Sphere{
rad: 13
p: Vec{75, 13, 82}
e: Vec{}
c: Vec{.96, .96, .96}.mult_s(.96)
refl: .refr
}, /* Glas */
}, // Glas
Sphere{
rad: 22
p: Vec{87, 22, 24}
e: Vec{}
c: Vec{.6, .6, .6}.mult_s(.696)
refl: .refr
} /* Glas2 */,
}, // Glas2
],
[// scene 3 Psychedelic
Sphere{

View file

@ -411,9 +411,9 @@ fn draw_cube_glsl(app App) {
time_ticks := f32(time.ticks() - app.ticks) / 1000
mut text_res := [
f32(512),
512, /* x,y resolution to pass to FS */
time_ticks, /* time as f32 */
0 /* padding 4 Bytes == 1 f32 */,
512, // x,y resolution to pass to FS
time_ticks, // time as f32
0, // padding 4 Bytes == 1 f32
]!
fs_uniforms_range := gfx.Range{
ptr: unsafe { &text_res }

View file

@ -286,7 +286,7 @@ fn init_cube_glsl_p(mut app App) {
vert_buffer_desc.@type = .vertexbuffer
vbuf := gfx.make_buffer(&vert_buffer_desc)
/* create an index buffer for the cube */
// create an index buffer for the cube
// vfmt off
indices := [
/*
@ -408,8 +408,8 @@ fn draw_cube_glsl_m(app App) {
ws.height * ratio, // x,y resolution to pass to FS
0,
0, // dont send mouse position
/* app.mouse_x, // mouse x */
/* ws.height - app.mouse_y*2, // mouse y scaled */
// app.mouse_x, // mouse x
// ws.height - app.mouse_y*2, // mouse y scaled
time_ticks, // time as f32
app.frame_count, // frame count
0,

View file

@ -52,14 +52,14 @@ const (
]
// Each tetro has its unique color
colors = [
gx.rgb(0, 0, 0), /* unused ? */
gx.rgb(255, 242, 0), /* yellow quad */
gx.rgb(174, 0, 255), /* purple triple */
gx.rgb(60, 255, 0), /* green short topright */
gx.rgb(255, 0, 0), /* red short topleft */
gx.rgb(255, 180, 31), /* orange long topleft */
gx.rgb(33, 66, 255), /* blue long topright */
gx.rgb(74, 198, 255), /* lightblue longest */
gx.rgb(0, 0, 0), // unused ?
gx.rgb(255, 242, 0), // yellow quad
gx.rgb(174, 0, 255), // purple triple
gx.rgb(60, 255, 0), // green short topright
gx.rgb(255, 0, 0), // red short topleft
gx.rgb(255, 180, 31), // orange long topleft
gx.rgb(33, 66, 255), // blue long topright
gx.rgb(74, 198, 255), // lightblue longest
gx.rgb(0, 170, 170),
]
background_color = gx.white

View file

@ -53,14 +53,14 @@ const (
]
// Each tetro has its unique color
colors = [
gx.rgb(0, 0, 0), /* unused ? */
gx.rgb(255, 242, 0), /* yellow quad */
gx.rgb(174, 0, 255), /* purple triple */
gx.rgb(60, 255, 0), /* green short topright */
gx.rgb(255, 0, 0), /* red short topleft */
gx.rgb(255, 180, 31), /* orange long topleft */
gx.rgb(33, 66, 255), /* blue long topright */
gx.rgb(74, 198, 255), /* lightblue longest */
gx.rgb(0, 0, 0), // unused ?
gx.rgb(255, 242, 0), // yellow quad
gx.rgb(174, 0, 255), // purple triple
gx.rgb(60, 255, 0), // green short topright
gx.rgb(255, 0, 0), // red short topleft
gx.rgb(255, 180, 31), // orange long topleft
gx.rgb(33, 66, 255), // blue long topright
gx.rgb(74, 198, 255), // lightblue longest
gx.rgb(0, 170, 170),
]
background_color = gx.white

File diff suppressed because it is too large Load diff

View file

@ -72,10 +72,10 @@ pub fn look_at(eye Vec4, center Vec4, up Vec4) Mat4 {
u := (s % f)
// vfmt off
return Mat4{e: [
/* [0][0] */ s.e[0], /* [0][1] */ u.e[0], /* [0][2] */ -f.e[0], /* [0][3] */ 0,
/* [1][1] */ s.e[1], /* [1][1] */ u.e[1], /* [1][2] */ -f.e[1], /* [1][3] */ 0,
/* [2][0] */ s.e[2], /* [2][1] */ u.e[2], /* [2][2] */ -f.e[2], /* [2][3] */ 0,
/* [3][0] */ -(s * eye), /* [3][1] */ -(u * eye), /* [3][2] */ f * eye, /* [3][3] */ 1,
s.e[0], u.e[0], -f.e[0], 0,
s.e[1], u.e[1], -f.e[1], 0,
s.e[2], u.e[2], -f.e[2], 0,
-(s * eye), -(u * eye), f * eye, 1,
]!}
// vfmt on
}

View file

@ -360,25 +360,25 @@ pub fn (a Mat4) * (b Mat4) Mat4 {
unsafe {
// vfmt off
return Mat4{ e: [
/* [0][0] */ a.f[0][0] * b.f[0][0] + a.f[0][1] * b.f[1][0] + a.f[0][2] * b.f[2][0] + a.f[0][3] * b.f[3][0],
/* [0][1] */ a.f[0][0] * b.f[0][1] + a.f[0][1] * b.f[1][1] + a.f[0][2] * b.f[2][1] + a.f[0][3] * b.f[3][1],
/* [0][2] */ a.f[0][0] * b.f[0][2] + a.f[0][1] * b.f[1][2] + a.f[0][2] * b.f[2][2] + a.f[0][3] * b.f[3][2],
/* [0][3] */ a.f[0][0] * b.f[0][3] + a.f[0][1] * b.f[1][3] + a.f[0][2] * b.f[2][3] + a.f[0][3] * b.f[3][3],
a.f[0][0] * b.f[0][0] + a.f[0][1] * b.f[1][0] + a.f[0][2] * b.f[2][0] + a.f[0][3] * b.f[3][0], // [0][0]
a.f[0][0] * b.f[0][1] + a.f[0][1] * b.f[1][1] + a.f[0][2] * b.f[2][1] + a.f[0][3] * b.f[3][1], // [0][1]
a.f[0][0] * b.f[0][2] + a.f[0][1] * b.f[1][2] + a.f[0][2] * b.f[2][2] + a.f[0][3] * b.f[3][2], // [0][2]
a.f[0][0] * b.f[0][3] + a.f[0][1] * b.f[1][3] + a.f[0][2] * b.f[2][3] + a.f[0][3] * b.f[3][3], // [0][3]
/* [1][0] */ a.f[1][0] * b.f[0][0] + a.f[1][1] * b.f[1][0] + a.f[1][2] * b.f[2][0] + a.f[1][3] * b.f[3][0],
/* [1][1] */ a.f[1][0] * b.f[0][1] + a.f[1][1] * b.f[1][1] + a.f[1][2] * b.f[2][1] + a.f[1][3] * b.f[3][1],
/* [1][2] */ a.f[1][0] * b.f[0][2] + a.f[1][1] * b.f[1][2] + a.f[1][2] * b.f[2][2] + a.f[1][3] * b.f[3][2],
/* [1][3] */ a.f[1][0] * b.f[0][3] + a.f[1][1] * b.f[1][3] + a.f[1][2] * b.f[2][3] + a.f[1][3] * b.f[3][3],
a.f[1][0] * b.f[0][0] + a.f[1][1] * b.f[1][0] + a.f[1][2] * b.f[2][0] + a.f[1][3] * b.f[3][0], // [1][0]
a.f[1][0] * b.f[0][1] + a.f[1][1] * b.f[1][1] + a.f[1][2] * b.f[2][1] + a.f[1][3] * b.f[3][1], // [1][1]
a.f[1][0] * b.f[0][2] + a.f[1][1] * b.f[1][2] + a.f[1][2] * b.f[2][2] + a.f[1][3] * b.f[3][2], // [1][2]
a.f[1][0] * b.f[0][3] + a.f[1][1] * b.f[1][3] + a.f[1][2] * b.f[2][3] + a.f[1][3] * b.f[3][3], // [1][3]
/* [2][0] */ a.f[2][0] * b.f[0][0] + a.f[2][1] * b.f[1][0] + a.f[2][2] * b.f[2][0] + a.f[2][3] * b.f[3][0],
/* [2][1] */ a.f[2][0] * b.f[0][1] + a.f[2][1] * b.f[1][1] + a.f[2][2] * b.f[2][1] + a.f[2][3] * b.f[3][1],
/* [2][2] */ a.f[2][0] * b.f[0][2] + a.f[2][1] * b.f[1][2] + a.f[2][2] * b.f[2][2] + a.f[2][3] * b.f[3][2],
/* [2][3] */ a.f[2][0] * b.f[0][3] + a.f[2][1] * b.f[1][3] + a.f[2][2] * b.f[2][3] + a.f[2][3] * b.f[3][3],
a.f[2][0] * b.f[0][0] + a.f[2][1] * b.f[1][0] + a.f[2][2] * b.f[2][0] + a.f[2][3] * b.f[3][0], // [2][0]
a.f[2][0] * b.f[0][1] + a.f[2][1] * b.f[1][1] + a.f[2][2] * b.f[2][1] + a.f[2][3] * b.f[3][1], // [2][1]
a.f[2][0] * b.f[0][2] + a.f[2][1] * b.f[1][2] + a.f[2][2] * b.f[2][2] + a.f[2][3] * b.f[3][2], // [2][2]
a.f[2][0] * b.f[0][3] + a.f[2][1] * b.f[1][3] + a.f[2][2] * b.f[2][3] + a.f[2][3] * b.f[3][3], // [2][3]
/* [3][0] */ a.f[3][0] * b.f[0][0] + a.f[3][1] * b.f[1][0] + a.f[3][2] * b.f[2][0] + a.f[3][3] * b.f[3][0],
/* [3][1] */ a.f[3][0] * b.f[0][1] + a.f[3][1] * b.f[1][1] + a.f[3][2] * b.f[2][1] + a.f[3][3] * b.f[3][1],
/* [3][2] */ a.f[3][0] * b.f[0][2] + a.f[3][1] * b.f[1][2] + a.f[3][2] * b.f[2][2] + a.f[3][3] * b.f[3][2],
/* [3][3] */ a.f[3][0] * b.f[0][3] + a.f[3][1] * b.f[1][3] + a.f[3][2] * b.f[2][3] + a.f[3][3] * b.f[3][3],
a.f[3][0] * b.f[0][0] + a.f[3][1] * b.f[1][0] + a.f[3][2] * b.f[2][0] + a.f[3][3] * b.f[3][0], // [3][0]
a.f[3][0] * b.f[0][1] + a.f[3][1] * b.f[1][1] + a.f[3][2] * b.f[2][1] + a.f[3][3] * b.f[3][1], // [3][1]
a.f[3][0] * b.f[0][2] + a.f[3][1] * b.f[1][2] + a.f[3][2] * b.f[2][2] + a.f[3][3] * b.f[3][2], // [3][2]
a.f[3][0] * b.f[0][3] + a.f[3][1] * b.f[1][3] + a.f[3][2] * b.f[2][3] + a.f[3][3] * b.f[3][3], // [3][3]
]!}
// vfmt on
}
@ -551,10 +551,10 @@ pub fn rotate(angle f32, w Vec4) Mat4 {
// vfmt off
return Mat4{ e: [
/* [0][0] */ (ax * ax * cv) + cs , /* [0][1] */ (ax * ay * cv) + az * sn , /* [0][2] */ (ax * az * cv) - ay * sn , /* [0][3] */ 0,
/* [1][0] */ (ay * ax * cv) - az * sn , /* [1][1] */ (ay * ay * cv) + cs , /* [1][2] */ (ay * az * cv) + ax * sn , /* [1][3] */ 0,
/* [2][0] */ (az * ax * cv) + ay * sn , /* [2][1] */ (az * ay * cv) - ax * sn , /* [2][2] */ (az * az * cv) + cs , /* [2][3] */ 0,
/* [3][0] */ 0, /* [3][1] */ 0 , /* [3][2] */ 0 , /* [3][3] */ 1,
(ax * ax * cv) + cs, (ax * ay * cv) + az * sn, (ax * az * cv) - ay * sn, 0,
(ay * ax * cv) - az * sn, (ay * ay * cv) + cs, (ay * az * cv) + ax * sn, 0,
(az * ax * cv) + ay * sn, (az * ay * cv) - ax * sn, (az * az * cv) + cs, 0,
0, 0, 0, 1,
]!}
// vfmt on
}

View file

@ -331,21 +331,41 @@ fn test_atan2() {
[pi, inf(1)], [pi, nan()], [inf(1), inf(-1)], [inf(1), -pi],
[inf(1), 0], [inf(1), pi], [inf(1), inf(1)], [inf(1), nan()],
[nan(), nan()]]
atan2_sc_ := [f64(-3.0) * pi / 4.0, /* atan2(-inf, -inf) */ -pi / 2, /* atan2(-inf, -pi) */
-pi / 2,
/* atan2(-inf, +0) */ -pi / 2, /* atan2(-inf, pi) */ -pi / 4, /* atan2(-inf, +inf) */
nan(), /* atan2(-inf, nan) */ -pi, /* atan2(-pi, -inf) */ -pi / 2, /* atan2(-pi, +0) */
-0.0,
/* atan2(-pi, inf) */ nan(), /* atan2(-pi, nan) */ -pi, /* atan2(-0, -inf) */ -pi,
/* atan2(-0, -pi) */ -pi, /* atan2(-0, -0) */ -0.0, /* atan2(-0, +0) */ -0.0, /* atan2(-0, pi) */
-0.0,
/* atan2(-0, +inf) */ nan(), /* atan2(-0, nan) */ pi, /* atan2(+0, -inf) */ pi, /* atan2(+0, -pi) */
pi, /* atan2(+0, -0) */ 0, /* atan2(+0, +0) */ 0, /* atan2(+0, pi) */ 0, /* atan2(+0, +inf) */
nan(), /* atan2(+0, nan) */ pi, /* atan2(pi, -inf) */ pi / 2, /* atan2(pi, +0) */ 0,
/* atan2(pi, +inf) */ nan(), /* atan2(pi, nan) */ 3.0 * pi / 4, /* atan2(+inf, -inf) */
pi / 2, /* atan2(+inf, -pi) */ pi / 2, /* atan2(+inf, +0) */ pi / 2, /* atan2(+inf, pi) */
pi / 4, /* atan2(+inf, +inf) */ nan(), /* atan2(+inf, nan) */
nan(), /* atan2(nan, nan) */
atan2_sc_ := [f64(-3.0) * pi / 4.0, // atan2(-inf, -inf)
-pi / 2, // atan2(-inf, -pi)
-pi / 2, // atan2(-inf, +0)
-pi / 2, // atan2(-inf, pi)
-pi / 4, // atan2(-inf, +inf)
nan(), // atan2(-inf, nan)
-pi, // atan2(-pi, -inf)
-pi / 2, // atan2(-pi, +0)
-0.0, // atan2(-pi, inf)
nan(), // atan2(-pi, nan)
-pi, // atan2(-0, -inf)
-pi, // atan2(-0, -pi)
-pi, // atan2(-0, -0)
-0.0, // atan2(-0, +0)
-0.0, // atan2(-0, pi)
-0.0, // atan2(-0, +inf)
nan(), // atan2(-0, nan)
pi, // atan2(+0, -inf)
pi, // atan2(+0, -pi)
pi, // atan2(+0, -0)
0, // atan2(+0, +0)
0, // atan2(+0, pi)
0, // atan2(+0, +inf)
nan(), // atan2(+0, nan)
pi, // atan2(pi, -inf)
pi / 2, // atan2(pi, +0)
0, // atan2(pi, +inf)
nan(), // atan2(pi, nan)
3.0 * pi / 4, // atan2(+inf, -inf)
pi / 2, // atan2(+inf, -pi)
pi / 2, // atan2(+inf, +0)
pi / 2, // atan2(+inf, pi)
pi / 4, // atan2(+inf, +inf)
nan(), // atan2(+inf, nan)
nan(), // atan2(nan, nan)
]
for i := 0; i < vfatan2_sc_.len; i++ {
f := atan2(vfatan2_sc_[i][0], vfatan2_sc_[i][1])
@ -528,10 +548,10 @@ fn test_exp() {
f := exp(math.vf_[i])
assert veryclose(math.exp_[i], f)
}
vfexp_sc_ := [inf(-1), -2000, 2000, inf(1), nan(), /* smallest f64 that overflows Exp(x) */
7.097827128933841e+02, 1.48852223e+09, 1.4885222e+09, 1, /* near zero */
3.725290298461915e-09,
/* denormal */ -740]
vfexp_sc_ := [inf(-1), -2000, 2000, inf(1), nan(), // smallest f64 that overflows Exp(x)
7.097827128933841e+02, 1.48852223e+09, 1.4885222e+09, 1, // near zero
3.725290298461915e-09, -740, // denormal
]
exp_sc_ := [f64(0), 0, inf(1), inf(1), nan(), inf(1), inf(1),
inf(1), 2.718281828459045, 1.0000000037252903, 4.2e-322]
for i := 0; i < vfexp_sc_.len; i++ {
@ -545,8 +565,10 @@ fn test_exp2() {
f := exp2(math.vf_[i])
assert soclose(math.exp2_[i], f, 1e-9)
}
vfexp2_sc_ := [f64(-2000), 2000, inf(1), nan(), /* smallest f64 that overflows Exp2(x) */
1024, /* near underflow */ -1.07399999999999e+03, /* near zero */ 3.725290298461915e-09]
vfexp2_sc_ := [f64(-2000), 2000, inf(1), nan(), // smallest f64 that overflows Exp2(x)
1024, -1.07399999999999e+03, // near underflow
3.725290298461915e-09, // near zero
]
exp2_sc_ := [f64(0), inf(1), inf(1), nan(), inf(1), 5e-324, 1.0000000025821745]
for i := 0; i < vfexp2_sc_.len; i++ {
f := exp2(vfexp2_sc_[i])
@ -577,7 +599,8 @@ fn test_gamma() {
vfgamma_ := [[inf(1), inf(1)], [inf(-1), nan()], [f64(0), inf(1)],
[f64(-0.0), inf(-1)], [nan(), nan()], [f64(-1), nan()],
[f64(-2), nan()], [f64(-3), nan()], [f64(-1e+16), nan()],
[f64(-1e+300), nan()], [f64(1.7e+308), inf(1)], /* Test inputs inspi_red by Python test suite. */
[f64(-1e+300), nan()], [f64(1.7e+308), inf(1)], // Test inputs inspi_red by Python test suite
// Outputs computed at high precision by PARI/GP.
// If recomputing table entries), be careful to use
// high-precision (%.1000g) formatting of the f64 inputs.
@ -646,12 +669,11 @@ fn test_hypot() {
vfhypot_sc_ := [[inf(-1), inf(-1)], [inf(-1), 0], [inf(-1),
inf(1)],
[inf(-1), nan()], [f64(-0.0), -0.0], [f64(-0.0), 0], [f64(0), -0.0],
[f64(0), 0], /* +0,0 */ [f64(0), inf(-1)], [f64(0), inf(1)],
[f64(0), nan()], [inf(1), inf(-1)], [inf(1), 0], [inf(1),
inf(1)],
[inf(1), nan()], [nan(), inf(-1)], [nan(), 0], [nan(),
inf(1)],
[nan(), nan()]]
[f64(0), 0], [f64(0), inf(-1)], [f64(0), inf(1)], [f64(0), nan()],
[inf(1), inf(-1)], [inf(1), 0], [inf(1), inf(1)], [inf(1),
nan()],
[nan(), inf(-1)], [nan(), 0], [nan(), inf(1)], [nan(),
nan()]]
hypot_sc_ := [inf(1), inf(1), inf(1), inf(1), 0, 0, 0, 0, inf(1),
inf(1), nan(), inf(1), inf(1), inf(1), inf(1), inf(1),
nan(), inf(1), nan()]
@ -755,27 +777,69 @@ fn test_pow() {
[inf(1), 1], [inf(1), pi], [inf(1), nan()], [nan(), -pi],
[nan(), -0.0], [nan(), 0], [nan(), 1], [nan(), pi], [nan(),
nan()]]
pow_sc_ := [f64(0), /* pow(-inf, -pi) */ -0.0, /* pow(-inf, -3) */ 1, /* pow(-inf, -0) */ 1, /* pow(-inf, +0) */
inf(-1), /* pow(-inf, 1) */ inf(-1), /* pow(-inf, 3) */
inf(1), /* pow(-inf, pi) */ inf(1), /* pow(-inf, 0.5) */
nan(), /* pow(-inf, nan) */ 0, /* pow(-pi, -inf) */ nan(), /* pow(-pi, -pi) */
1, /* pow(-pi, -0) */ 1, /* pow(-pi, +0) */ -pi, /* pow(-pi, 1) */ nan(), /* pow(-pi, pi) */
inf(1), /* pow(-pi, +inf) */ nan(), /* pow(-pi, nan) */ 1, /* pow(-1, -inf) IEEE 754-2008 */
1, /* pow(-1, +inf) IEEE 754-2008 */ nan(), /* pow(-1, nan) */
inf(1), /* pow(-1/2, -inf) */ 0, /* pow(-1/2, +inf) */ inf(1), /* pow(-0, -inf) */
inf(1), /* pow(-0, -pi) */ inf(1), /* pow(-0, -0.5) */
inf(-1), /* pow(-0, -3) IEEE 754-2008 */ -0.0, /* pow(-0, 3) IEEE 754-2008 */ 0, /* pow(-0, pi) */
0, /* pow(-0, 0.5) */ 0, /* pow(-0, +inf) */ inf(1), /* pow(+0, -inf) */
inf(1), /* pow(+0, -pi) */ inf(1), /* pow(+0, -3) */ 1, /* pow(+0, -0) */ 1, /* pow(+0, +0) */
0, /* pow(+0, 3) */ 0,
/* pow(+0, pi) */ 0, /* pow(+0, +inf) */ nan(), /* pow(+0, nan) */
inf(1), /* pow(1/2, -inf) */ 0, /* pow(1/2, +inf) */ 1, /* pow(1, -inf) IEEE 754-2008 */
1, /* pow(1, +inf) IEEE 754-2008 */ 1, /* pow(1, nan) IEEE 754-2008 */ 0, /* pow(pi, -inf) */
1, /* pow(pi, -0) */ 1, /* pow(pi, +0) */ pi, /* pow(pi, 1) */ inf(1), /* pow(pi, +inf) */
nan(), /* pow(pi, nan) */ 0, /* pow(+inf, -pi) */ 1, /* pow(+inf, -0) */ 1, /* pow(+inf, +0) */
inf(1), /* pow(+inf, 1) */ inf(1), /* pow(+inf, pi) */
nan(), /* pow(+inf, nan) */ nan(), /* pow(nan, -pi) */ 1, /* pow(nan, -0) */ 1, /* pow(nan, +0) */
nan(), /* pow(nan, 1) */ nan(), /* pow(nan, pi) */ nan(), /* pow(nan, nan) */]
pow_sc_ := [f64(0), // pow(-inf, -pi)
-0.0, // pow(-inf, -3)
1, // pow(-inf, -0)
1, // pow(-inf, +0)
inf(-1), // pow(-inf, 1)
inf(-1), // pow(-inf, 3)
inf(1), // pow(-inf, pi)
inf(1), // pow(-inf, 0.5)
nan(), // pow(-inf, nan)
0, // pow(-pi, -inf)
nan(), // pow(-pi, -pi)
1, // pow(-pi, -0)
1, // pow(-pi, +0)
-pi, // pow(-pi, 1)
nan(), // pow(-pi, pi)
inf(1), // pow(-pi, +inf)
nan(), // pow(-pi, nan)
1, // pow(-1, -inf) IEEE 754-2008
1, // pow(-1, +inf) IEEE 754-2008
nan(), // pow(-1, nan)
inf(1), // pow(-1/2, -inf)
0, // pow(-1/2, +inf)
inf(1), // pow(-0, -inf)
inf(1), // pow(-0, -pi)
inf(1), // pow(-0, -0.5)
inf(-1), // pow(-0, -3) IEEE 754-2008
-0.0, // pow(-0, 3) IEEE 754-2008
0, // pow(-0, pi)
0, // pow(-0, 0.5)
0, // pow(-0, +inf)
inf(1), // pow(+0, -inf)
inf(1), // pow(+0, -pi)
inf(1), // pow(+0, -3)
1, // pow(+0, -0)
1, // pow(+0, +0)
0, // pow(+0, 3)
0, // pow(+0, pi)
0, // pow(+0, +inf)
nan(), // pow(+0, nan)
inf(1), // pow(1/2, -inf)
0, // pow(1/2, +inf)
1, // pow(1, -inf) IEEE 754-2008
1, // pow(1, +inf) IEEE 754-2008
1, // pow(1, nan) IEEE 754-2008
0, // pow(pi, -inf)
1, // pow(pi, -0)
1, // pow(pi, +0)
pi, // pow(pi, 1)
inf(1), // pow(pi, +inf)
nan(), // pow(pi, nan)
0, // pow(+inf, -pi)
1, // pow(+inf, -0)
1, // pow(+inf, +0)
inf(1), // pow(+inf, 1)
inf(1), // pow(+inf, pi)
nan(), // pow(+inf, nan)
nan(), // pow(nan, -pi)
1, // pow(nan, -0)
1, // pow(nan, +0)
nan(), // pow(nan, 1)
nan(), // pow(nan, pi)
nan(), // pow(nan, nan)
]
for i := 0; i < vfpow_sc_.len; i++ {
f := pow(vfpow_sc_[i][0], vfpow_sc_[i][1])
assert alike(pow_sc_[i], f)
@ -793,14 +857,14 @@ fn test_round() {
assert alike(math.round_[i], f)
}
vfround_sc_ := [[f64(0), 0], [nan(), nan()], [inf(1), inf(1)]]
// vfround_even_sc_ := [[f64(0), 0], [f64(1.390671161567e-309), 0], /* denormal */
// [f64(0.49999999999999994), 0], /* 0.5-epsilon */ [f64(0.5), 0],
// [f64(0.5000000000000001), 1], /* 0.5+epsilon */ [f64(-1.5), -2],
// vfround_even_sc_ := [[f64(0), 0], [f64(1.390671161567e-309), 0], // denormal
// [f64(0.49999999999999994), 0], // 0.5-epsilon [f64(0.5), 0],
// [f64(0.5000000000000001), 1], // 0.5+epsilon [f64(-1.5), -2],
// [f64(-2.5), -2], [nan(), nan()], [inf(1), inf(1)],
// [f64(2251799813685249.5), 2251799813685250],
// // 1 bit fractian [f64(2251799813685250.5), 2251799813685250],
// [f64(4503599627370495.5), 4503599627370496], /* 1 bit fraction, rounding to 0 bit fractian */
// [f64(4503599627370497), 4503599627370497], /* large integer */
// [f64(4503599627370495.5), 4503599627370496], // 1 bit fraction, rounding to 0 bit fractian
// [f64(4503599627370497), 4503599627370497], // large integer
// ]
for i := 0; i < vfround_sc_.len; i++ {
f := round(vfround_sc_[i][0])

View file

@ -712,7 +712,10 @@ pub fn executable() string {
}
$if freebsd {
bufsize := usize(max_path_buffer_size)
mib := [1 /* CTL_KERN */, 14 /* KERN_PROC */, 12 /* KERN_PROC_PATHNAME */, -1]
mib := [1, // CTL_KERN
14, // KERN_PROC
12, // KERN_PROC_PATHNAME
-1]
unsafe { C.sysctl(mib.data, mib.len, &result[0], &bufsize, 0, 0) }
res := unsafe { tos_clone(&result[0]) }
return res

View file

@ -162,17 +162,37 @@ pub fn sigint_to_signal_name(si int) string {
match si {
// TODO dependent on platform
// works only on x86/ARM/most others
10 /* , 30, 16 */ { return 'SIGUSR1' }
12 /* , 31, 17 */ { return 'SIGUSR2' }
17 /* , 20, 18 */ { return 'SIGCHLD' }
18 /* , 19, 25 */ { return 'SIGCONT' }
19 /* , 17, 23 */ { return 'SIGSTOP' }
20 /* , 18, 24 */ { return 'SIGTSTP' }
21 /* , 26 */ { return 'SIGTTIN' }
22 /* , 27 */ { return 'SIGTTOU' }
10 { // , 30, 16
return 'SIGUSR1'
}
12 { // , 31, 17
return 'SIGUSR2'
}
17 { // , 20, 18
return 'SIGCHLD'
}
18 { // , 19, 25
return 'SIGCONT'
}
19 { // , 17, 23
return 'SIGSTOP'
}
20 { // , 18, 24
return 'SIGTSTP'
}
21 { // , 26
return 'SIGTTIN'
}
22 { // , 27
return 'SIGTTOU'
}
// /////////////////////////////
5 { return 'SIGTRAP' }
7 { return 'SIGBUS' }
5 {
return 'SIGTRAP'
}
7 {
return 'SIGBUS'
}
else {}
}
}

View file

@ -86,7 +86,7 @@ fn C.sapp_get_clipboard_string() &u8
// set the window title (only on desktop platforms)
fn C.sapp_set_window_title(&char)
// /* set the window icon (only on Windows and Linux) */
// set the window icon (only on Windows and Linux)
// SOKOL_APP_API_DECL void sapp_set_icon(const sapp_icon_desc* icon_desc);
// Get number of dropped files
@ -104,10 +104,10 @@ fn C.sapp_gles2() bool
// HTML5: enable or disable the hardwired "Leave Site?" dialog box
fn C.sapp_html5_ask_leave_site(ask bool)
// /* HTML5: get byte size of a dropped file */
// HTML5: get byte size of a dropped file
// SOKOL_APP_API_DECL uint32_t sapp_html5_get_dropped_file_size(int index);
// /* HTML5: asynchronously load the content of a dropped file */
// HTML5: asynchronously load the content of a dropped file
// SOKOL_APP_API_DECL void sapp_html5_fetch_dropped_file(const sapp_html5_fetch_request* request);
// Metal: get ARC-bridged pointer to Metal device object

View file

@ -255,7 +255,7 @@ fn (mut ctx Context) parse_events() {
modifiers: modifiers
})
}
0x0008 /* C.MOUSE_HWHEELED */ {
0x0008 { // C.MOUSE_HWHEELED
ctx.event(&Event{
typ: .mouse_scroll
direction: if i16(e.dwButtonState >> 16) < 0 {
@ -268,7 +268,7 @@ fn (mut ctx Context) parse_events() {
modifiers: modifiers
})
}
0 /* CLICK */, C.DOUBLE_CLICK {
0, C.DOUBLE_CLICK {
button := match int(e.dwButtonState) {
0 { ctx.mouse_down }
1 { MouseButton.left }

View file

@ -1609,10 +1609,10 @@ pub const (
// map register size -> register name
x86_no_number_register_list = {
8: ['al', 'ah', 'bl', 'bh', 'cl', 'ch', 'dl', 'dh', 'bpl', 'sil', 'dil', 'spl']
16: ['ax', 'bx', 'cx', 'dx', 'bp', 'si', 'di', 'sp', /* segment registers */ 'cs', 'ss',
'ds', 'es', 'fs', 'gs', 'flags', 'ip', /* task registers */ 'gdtr', 'idtr', 'tr', 'ldtr',
// CSR register 'msw', /* FP core registers */ 'cw', 'sw', 'tw', 'fp_ip', 'fp_dp',
'fp_cs', 'fp_ds', 'fp_opc']
16: ['ax', 'bx', 'cx', 'dx', 'bp', 'si', 'di', 'sp', // segment registers
'cs', 'ss', 'ds', 'es', 'fs', 'gs', 'flags', 'ip', // task registers
'gdtr', 'idtr', 'tr', 'ldtr', // CSR register 'msw', /* FP core registers */ 'cw', 'sw', 'tw', 'fp_ip', 'fp_dp', 'fp_cs',
'fp_ds', 'fp_opc']
32: [
'eax',
'ebx',
@ -1623,8 +1623,8 @@ pub const (
'edi',
'esp',
'eflags',
'eip', /* CSR register */
'mxcsr' /* 32-bit FP core registers 'fp_dp', 'fp_ip' (TODO: why are there duplicates?) */,
'eip', // CSR register
'mxcsr', // 32-bit FP core registers 'fp_dp', 'fp_ip' (TODO: why are there duplicates?)
]
64: ['rax', 'rbx', 'rcx', 'rdx', 'rbp', 'rsi', 'rdi', 'rsp', 'rflags', 'rip']
}
@ -1667,9 +1667,11 @@ pub const (
// TODO: saved priviled registers for arm
pub const (
arm_no_number_register_list = ['fp' /* aka r11 */, /* not instruction pointer: */ 'ip' /* aka r12 */,
'sp' /* aka r13 */, 'lr' /* aka r14 */, /* this is instruction pointer ('program counter'): */
'pc' /* aka r15 */,
arm_no_number_register_list = ['fp', // aka r11
'ip', // not instruction pointer: aka r12
'sp', // aka r13
'lr', // aka r14
'pc', // this is instruction pointer ('program counter'): aka r15
] // 'cpsr' and 'apsr' are special flags registers, but cannot be referred to directly
arm_with_number_register_list = {
'r#': 16

View file

@ -148,14 +148,14 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
'-Wno-type-limits',
'-Wno-tautological-compare',
// these cause various issues:
'-Wno-shadow' /* the V compiler already catches this for user code, and enabling this causes issues with e.g. the `it` variable */,
'-Wno-int-to-pointer-cast' /* gcc version of the above */,
'-Wno-trigraphs' /* see stackoverflow.com/a/8435413 */,
'-Wno-missing-braces' /* see stackoverflow.com/q/13746033 */,
'-Wno-shadow', // the V compiler already catches this for user code, and enabling this causes issues with e.g. the `it` variable
'-Wno-int-to-pointer-cast', // gcc version of the above
'-Wno-trigraphs', // see stackoverflow.com/a/8435413
'-Wno-missing-braces', // see stackoverflow.com/q/13746033
// enable additional warnings:
'-Wno-unknown-warning' /* if a C compiler does not understand a certain flag, it should just ignore it */,
'-Wno-unknown-warning-option' /* clang equivalent of the above */,
'-Wno-excess-initializers' /* vlib/v/tests/struct_init_with_complex_fields_test.v fails without that on macos clang 13 */,
'-Wno-unknown-warning', // if a C compiler does not understand a certain flag, it should just ignore it
'-Wno-unknown-warning-option', // clang equivalent of the above
'-Wno-excess-initializers', // vlib/v/tests/struct_init_with_complex_fields_test.v fails without that on macos clang 13
'-Wdate-time',
'-Wduplicated-branches',
'-Wduplicated-cond',
@ -232,8 +232,8 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
}
ccoptions.wargs << [
'-Wno-tautological-bitwise-compare',
'-Wno-enum-conversion' /* used in vlib/sokol, where C enums in C structs are typed as V structs instead */,
'-Wno-sometimes-uninitialized' /* produced after exhaustive matches */,
'-Wno-enum-conversion', // used in vlib/sokol, where C enums in C structs are typed as V structs instead
'-Wno-sometimes-uninitialized', // produced after exhaustive matches
'-Wno-int-to-void-pointer-cast',
]
}

View file

@ -1847,7 +1847,7 @@ fn (mut c Checker) enum_decl(mut node ast.EnumDecl) {
c.ident(mut field.expr)
}
if field.expr.kind == .constant && field.expr.obj.typ.is_int() {
/* accepts int constants as enum value */
// accepts int constants as enum value
continue
}
}

View file

@ -777,8 +777,10 @@ fn expr_is_single_line(expr ast.Expr) bool {
}
}
ast.ArrayInit {
if expr.exprs.len > 0 {
return expr_is_single_line(expr.exprs[0])
for e in expr.exprs {
if !expr_is_single_line(e) {
return false
}
}
}
ast.ConcatExpr {
@ -1766,9 +1768,11 @@ pub fn (mut f Fmt) array_init(node ast.ArrayInit) {
}
f.write(' ')
f.comment(cmt)
if !line_break {
f.writeln('')
}
}
}
last_comment_was_inline = cmt.is_inline
}
} else if i == node.exprs.len - 1 && !line_break {
is_new_line = false

View file

@ -5,5 +5,4 @@ v := [
// 2-3
3, // 3
// 4
/* 5 */
]

View file

@ -5,5 +5,4 @@ v := [
// 2-3
3, // 3
// 4
/* 5 */
]

View file

@ -1,2 +0,0 @@
a := [1 /* y */, /* x */ 2, 3]
println(a)

View file

@ -1,7 +0,0 @@
module main
fn main() {
println('Hello World!')
}
fn C.f( /* mut */ buff &char) i64

View file

@ -1,7 +0,0 @@
module main
fn main() {
println('Hello World!')
}
fn C.f(/*mut*/buff &char) i64

View file

@ -9,7 +9,7 @@ fn main() {
// below expr
]
_ := [
8, /* I don't know why this still is a block comment */
8, // I don't know why this still is a block comment
9,
]
arr := [
@ -18,39 +18,27 @@ fn main() {
// test 1
2,
// test 2
3, /* 3 */
4, /* 4-1 */ /* 4-2 */
3, // 3
4, // 4-1
]
}
fn only_comments_array() {
_ := [/* on a single line */ /* too */]
_ := []
_ := [
// 1,
// 2,
// 3,
]
_ := [
/* whatever */ /* this is */ // 3,
// whatever */ /* this is */ // 3,
// 4,
]
}
fn single_line_array_pre_comments() {
_ := [/* 2, */ 3]
_ := [/* 4, */ /* 5, */ 6]
_ := [/* cmt */ -4]
}
fn single_line_array_iembed_comments() {
_ := [1, /* betw single line */ 2]
// This caused a bug where the ´-´ was parsed as InfixExpr and not as part of an IntegerLiteral
_ := [1, /* cmt */ -4]
}
fn mixed_comments() {
_ := [
3 /* iembed */,
3, // iembed
// keep line comment here
// and here
5,
@ -68,12 +56,3 @@ fn keep_real_block_comment() {
'eggs',
]
}
fn comment_at_line_start_with_expressions_after() {
arr := [123456789012345, 234567890123456, 678901234567890, 789012345678901, /* at the end */
345678901234567, /* in between */ 456789012345678,
/* line start */ 567890123456789, 890123456789012]
arr2 := [/* same line pre comment */ Foo{
a: 123
}]
}

View file

@ -6,23 +6,24 @@ comment
*/
fn fun() int {
return /* comment zero */ 0 // another comment
return 0 // another comment
}
fn mr_fun() (int, int) {
return /* one comment */ 1, /* another comment */ 2
return 1, // one comment
2 // another comment
}
fn single_line_blocks() {
/* 1 */
// 1
println('')
/* 2 */
// 2
println('')
/* 3 */
/* 4 */
// 3
// 4
println('')
// 5
/* 6 */
// 6
}
fn main() {
@ -35,28 +36,15 @@ fn main() {
/*
block3
*/
a := /* this is a comment */ 1
b, c := /* and another comment */ a, /* just to make it worse */ 2
a := 1 // this is a comment
d := c // and an extra one
e := c
// more comments = more good
arr := [
/* block foo bar */
// block foo bar
// inline foo bar
0,
]
println( /* before arg comment */ 'this is a test' /* after arg comment */ )
if /* before if expr */ true /* after if expr */ {
println('if')
}
// before else if
else if /* between else if */ false {
println('else if')
}
// before else
else {
println('else')
}
return
}
@ -96,32 +84,12 @@ for // comments
break
}
for /* comments */ {
break
}
for i := 0; i < 1; i++ // comments
{
break
}
for i := 0; i < 1; i++ /* comments */ {
break
}
for /* comments1 */ i := 0; /* comments2 */ i < 1; /* comments3 */ i++ /* comments4 */ {
break
}
for _ in [1, 2] /* comments */ {
break
}
for _ in [1, 2] // comments
{
break
}
for /* comments1 */ _ in /* comments2 */ [1, 2] /* comments3 */ {
break
}

View file

@ -5,23 +5,24 @@ comment
*/
fn fun() int {
return /* comment zero */ 0 // another comment
return 0 // another comment
}
fn mr_fun() (int, int) {
return /* one comment */ 1, /* another comment */ 2
return 1, // one comment
2 // another comment
}
fn single_line_blocks() {
/* 1 */
// 1
println('')
/* 2 */
// 2
println('')
/* 3 */
/* 4 */
// 3
// 4
println('')
// 5
/* 6 */
// 6
}
fn main() {
@ -34,28 +35,15 @@ fn main() {
block3
*/
a := /* this is a comment */ 1
b, c := /* and another comment */ a, /* just to make it worse */ 2
a := 1 // this is a comment
d := c // and an extra one
e := c
// more comments = more good
arr := [
/* block foo bar */
// block foo bar
// inline foo bar
0,
]
println(/* before arg comment */ 'this is a test' /* after arg comment */)
if /* before if expr */ true /* after if expr */ {
println('if')
}
// before else if
else /* between else if */ if false {
println('else if')
}
// before else
else /* after else */ {
println('else')
}
return // empty return
}
@ -93,32 +81,12 @@ for // comments
break
}
for /* comments */ {
break
}
for i := 0; i < 1; i++ // comments
{
break
}
for i := 0; i < 1; i++ /* comments */ {
break
}
for /* comments1 */ i := 0; /* comments2 */ i < 1; /* comments3 */ i++ /* comments4 */ {
break
}
for _ in [1, 2] /* comments */ {
break
}
for _ in [1, 2] // comments
{
break
}
for /* comments1 */ _ in /* comments2 */ [1, 2] /* comments3 */ {
break
}

View file

@ -1,2 +0,0 @@
if true /* comments */ {
}

View file

@ -1,2 +0,0 @@
if true /* comments */ {
}

View file

@ -9,7 +9,7 @@ const two = 2
move
*/
const three = 3 /* rewrite and leave */
const three = 3 // rewrite and leave
// leave
const four = 4 // leave

View file

@ -5,7 +5,7 @@ const one = 1 // leave
const two = 2 /* move
*/
const three = 3 /* rewrite and leave */
const three = 3 // rewrite and leave
// leave
const four = 4 // leave

View file

@ -1,12 +1,8 @@
fn C.Mix_LoadMUS1(file byteptr) voidptr // *Mix_Music
fn C.Mix_LoadMUS2(file byteptr) voidptr /* *Mix_Music */
fn C.Mix_LoadMUS2(file byteptr) voidptr // *Mix_Music*
fn C.Mix_LoadMUS3(file byteptr) voidptr /* 1 */
/* 2 */
/* 3 */
fn C.Mix_LoadMUS3(file byteptr) voidptr // 1 2 3
// Loads music
fn C.Mix_LoadMUS4(file byteptr) voidptr

View file

@ -1,8 +1,8 @@
fn C.Mix_LoadMUS1(file byteptr) voidptr // *Mix_Music
fn C.Mix_LoadMUS2(file byteptr) voidptr /* *Mix_Music */
fn C.Mix_LoadMUS2(file byteptr) voidptr // *Mix_Music*
fn C.Mix_LoadMUS3(file byteptr) voidptr /* 1 */ /* 2 */ /* 3 */
fn C.Mix_LoadMUS3(file byteptr) voidptr // 1 2 3
// Loads music
fn C.Mix_LoadMUS4(file byteptr) voidptr /* Test

View file

@ -1,8 +0,0 @@
fn /* main */ main() {
return
}
fn // hi
print_hi() {
println('hi')
}

View file

@ -1,6 +0,0 @@
fn /*main*/main() {
return
}
fn // hi
print_hi(){println('hi')}

View file

@ -1,8 +0,0 @@
fn foo(
// Foo
s string) {
}
fn bar( /* p1 */ a string, /* p2 */ b int) {
println('hello')
}

View file

@ -1,8 +0,0 @@
fn foo(
// Foo
s string) {
}
fn bar(/*p1*/a string, /*p2*/b int) {
println('hello')
}

View file

@ -1,5 +1,6 @@
fn main() {
filtered_links := text_processing.filter_links(links, /* unwanted_domains = */ [
filtered_links := text_processing.filter_links(links, // unwanted_domains
[
'www.kickstarter.com',
'www.pepper.pl',
'tenor.com',

View file

@ -1,12 +0,0 @@
fn main() {
a, b := true, true
if a || b // a
{
println('hi')
}
if a || b /* a */ {
println('hi')
}
}

View file

@ -1,10 +0,0 @@
fn main() {
a, b := true, true
if a || // a
b {
println('hi')
}
if a /* a */ || b {println('hi')}
}

View file

@ -1,9 +1,9 @@
fn main() {
a := 4 // comment1
+ /* comment2 */ 6
+ 6 // comment2
b := 5 /* comment1 */ + // comment2
b := 5 + // comment2
6
c := 4 /* comment1 */ + /* comment2 */ 6 // comment3
c := 4 + 6 // comment3
}

View file

@ -1,22 +0,0 @@
fn foo1() int {
return (0 /* some comment */ )
}
fn foo2() int {
return ( /* some comment */ 0)
}
fn foo3() int {
return ( /* some comment1 */ 0 /* some comment2 */ )
}
fn foo4() int {
return ( /* some comment1 */ /* some comment2 */ 0)
}
fn foo5() int {
return ( /* some comment1 */ /* some comment2 */ 0 /* some comment3 */ /* some comment4 */ )
}
fn main() {
}

View file

@ -41,11 +41,11 @@ struct SomeStruct {
mut:
// 2
// 3
somefield /* 4 */ /* 5 */ int /* 6 */ /* 7 */ /* 8 */ /*
somefield int /*
9
10
*/
somefield2 /* 11 */ int // 12
somefield2 int // 12
pub:
somefield3 int

View file

@ -41,11 +41,11 @@ struct SomeStruct {
mut:
// 2
// 3
somefield /*4*/ /*5*/ int /*6*/ /*7*/ /*8*/ /*
somefield int /*
9
10
*/
somefield2 /*11*/ int // 12
somefield2 int // 12
pub:

View file

@ -23,8 +23,8 @@ fn test_decode_a() {
TestData{'D', -1},
TestData{'2H', 123},
TestData{'qxmvrH', 123456789},
TestData{'+/////B', 1073741823} /* 2^30-1 */,
// TestData{'hgggggggggggI', 9_223_372_036_854_775_808} /* 2^63 */,
TestData{'+/////B', 1073741823}, // 2^30-1
// TestData{'hgggggggggggI', 9_223_372_036_854_775_808} // 2^63
]
for _, test_data in decode_values {

View file

@ -17,8 +17,8 @@ fn test_encode_a() {
TestData{'D', -1},
TestData{'2H', 123},
TestData{'qxmvrH', 123456789},
TestData{'+/////B', 1073741823} /* 2^30-1 */,
// TestData{'hgggggggggggI', 9_223_372_036_854_775_808} /* 2^63 */,
TestData{'+/////B', 1073741823}, // 2^30-1
// TestData{'hgggggggggggI', 9_223_372_036_854_775_808} // 2^63
]
for _, test_data in decode_values {
mut output := TestWriter{}

View file

@ -26,8 +26,8 @@ pub fn mark_used(mut table ast.Table, pref_ &pref.Preferences, ast_files []&ast.
'__new_array_with_default',
'__new_array_with_multi_default',
'__new_array_with_array_default',
'init_global_allocator' /* needed for linux_bare and wasm_bare */,
'v_realloc' /* needed for _STR */,
'init_global_allocator', // needed for linux_bare and wasm_bare
'v_realloc', // needed for _STR
'malloc',
'malloc_noscan',
'vcalloc',
@ -89,12 +89,12 @@ pub fn mark_used(mut table ast.Table, pref_ &pref.Preferences, ast_files []&ast.
'22.set',
'22.get_unsafe',
'22.set_unsafe',
'22.get_with_check' /* used for `x := a[i] or {}` */,
'22.get_with_check', // used for `x := a[i] or {}`
'22.clone_static_to_depth',
'22.clone_to_depth',
'22.first',
'22.last',
'22.pointers' /* TODO: handle generic methods calling array primitives more precisely in pool_test.v */,
'22.pointers', // TODO: handle generic methods calling array primitives more precisely in pool_test.v
'22.reverse',
'22.repeat_to_depth',
'22.slice',

View file

@ -1111,9 +1111,17 @@ fn (mut s Scanner) text_scan() token.Token {
}
s.pos++
if s.should_parse_comment() {
mut comment := s.text[start..(s.pos - 1)].trim(' ')
mut comment := s.text[start..(s.pos - 1)]
if !comment.contains('\n') {
comment = '\x01' + comment
comment_pos := token.Pos{
line_nr: start_line
len: comment.len + 4
pos: start
col: s.current_column() - comment.len - 4
}
s.error_with_pos('inline comment is deprecated, please use line comment',
comment_pos)
comment = '\x01' + comment.trim(' ')
}
return s.new_multiline_token(.comment, comment, comment.len + 4,
start_line)

View file

@ -1161,21 +1161,21 @@ fn tst() {
mut tf := TTF_File{}
tf.buf = [
u8(0xFF), /* 8 bit */
u8(0xFF), // 8 bit
0xF1,
0xF2, /* 16 bit */
0xF2, // 16 bit
0x81,
0x23,
0x45,
0x67, /* 32 bit */
0x67, // 32 bit
0x12,
0x34,
0x12,
0x34, /* get_2dot14 16 bit */
0x34, // get_2dot14 16 bit
0x12,
0x34,
0x12,
0x34 /* get_fixed 32 bit int */,
0x34, // get_fixed 32 bit int
]
assert tf.get_u8().hex() == 'ff'
assert tf.get_u16().hex() == 'f1f2'