mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
parser: deprecate short struct init (#10842)
This commit is contained in:
parent
dc045806f9
commit
ad3835b598
85 changed files with 234 additions and 238 deletions
|
@ -20,7 +20,7 @@ mut:
|
|||
}
|
||||
|
||||
fn random_color() tui.Color {
|
||||
return {
|
||||
return tui.Color{
|
||||
r: byte(rand.intn(256))
|
||||
g: byte(rand.intn(256))
|
||||
b: byte(rand.intn(256))
|
||||
|
@ -32,7 +32,7 @@ fn event(e &tui.Event, x voidptr) {
|
|||
match e.typ {
|
||||
.mouse_down {
|
||||
app.is_drag = true
|
||||
app.cur_rect = {
|
||||
app.cur_rect = Rect{
|
||||
c: random_color()
|
||||
x: e.x
|
||||
y: e.y
|
||||
|
|
|
@ -156,20 +156,20 @@ fn event(event &ui.Event, x voidptr) {
|
|||
app.is_dragging = false
|
||||
}
|
||||
.mouse_drag {
|
||||
app.mouse_pos = {
|
||||
app.mouse_pos = Point{
|
||||
x: event.x
|
||||
y: event.y
|
||||
}
|
||||
app.paint(event)
|
||||
}
|
||||
.mouse_move {
|
||||
app.mouse_pos = {
|
||||
app.mouse_pos = Point{
|
||||
x: event.x
|
||||
y: event.y
|
||||
}
|
||||
}
|
||||
.mouse_scroll {
|
||||
app.mouse_pos = {
|
||||
app.mouse_pos = Point{
|
||||
x: event.x
|
||||
y: event.y
|
||||
}
|
||||
|
|
|
@ -147,9 +147,9 @@ fn (b Buffer) view(from int, to int) View {
|
|||
}
|
||||
}
|
||||
raw := lines.join('\n')
|
||||
return {
|
||||
return View{
|
||||
raw: raw.replace('\t', strings.repeat(` `, b.tab_width))
|
||||
cursor: {
|
||||
cursor: Cursor{
|
||||
pos_x: x
|
||||
pos_y: b.cursor.pos_y
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ fn (mut v Vec) randomize(min_x int, min_y int, max_x int, max_y int) {
|
|||
// part of snake's body representation
|
||||
struct BodyPart {
|
||||
mut:
|
||||
pos Vec = {
|
||||
pos Vec = Vec{
|
||||
x: block_size
|
||||
y: block_size
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ fn (s Snake) draw() {
|
|||
// rat representation
|
||||
struct Rat {
|
||||
mut:
|
||||
pos Vec = {
|
||||
pos Vec = Vec{
|
||||
x: block_size
|
||||
y: block_size
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue