pull/3208/head
BigBlack 2019-12-27 11:09:09 +08:00 committed by Alexander Medvednikov
parent 1277ce22f8
commit 320174bd5b
2 changed files with 15 additions and 1 deletions

View File

@ -542,3 +542,17 @@ fn test_for_last() {
assert s == '[1, 2, 3, 4]'
}
*/
struct Foo {
mut:
bar []int
}
fn test_in_struct() {
mut baz := Foo{
bar: [0, 0, 0]
}
baz.bar[0] += 2
baz.bar[0]++
assert baz.bar[0] == 3
}

View File

@ -1964,7 +1964,7 @@ fn (p mut Parser) var_expr(v Var) string {
// p.print_tok()
// dc++
if p.tok == .lsbr {
// typ = p.index_expr(typ, fn_ph, v)
typ = p.index_expr(typ, fn_ph)
}
}
// `a++` and `a--`