diff --git a/cmd/tools/vself.v b/cmd/tools/vself.v index e741f20417..83f3160ffb 100644 --- a/cmd/tools/vself.v +++ b/cmd/tools/vself.v @@ -13,10 +13,10 @@ fn main() { mut cmd := '$vexe -o v2 cmd/v' if os.args.len >= 3 && os.args[2] == '-prod' { cmd = '$vexe -o v2 -prod cmd/v' - println('V Self Compiling (-prod mode)...') + println('V self compiling (-prod mode)...') } else { - println('V Self Compiling...') + println('V self compiling...') } s2 := os.exec(cmd) or { panic(err) } diff --git a/vlib/builtin/array_test.v b/vlib/builtin/array_test.v index 58fbf65a56..d3056821a5 100644 --- a/vlib/builtin/array_test.v +++ b/vlib/builtin/array_test.v @@ -288,7 +288,7 @@ fn test_fixed() { assert nums[3] == 0 nums[1] = 7 assert nums[1] == 7 - nums2 := [N]int + nums2 := [5]int // N assert nums2[N - 1] == 0 } @@ -298,6 +298,7 @@ fn modify(numbers mut []int) { fn test_mut_slice() { mut n := [1, 2, 3] + //modify(mut n) modify(mut n[..2]) assert n[0] == 777 modify(mut n[2..]) @@ -574,7 +575,7 @@ fn test_push_many_self() { fn test_for() { nums := [1,2,3] mut sum := 0 - for num <- nums { + for num in nums { sum += num } assert sum == 6 diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 742fb1f463..e1e679e3e8 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -531,6 +531,9 @@ fn (c mut Checker) stmt(node ast.Stmt) { c.assign_stmt(mut it) c.expected_type = table.void_type } + ast.Block { + c.stmts(it.stmts) + } // ast.Attr {} ast.CompIf { // c.expr(it.cond) diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index e456aba354..cf1d30a5a6 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -277,6 +277,11 @@ fn (g mut Gen) stmt(node ast.Stmt) { ast.Attr { g.writeln('//[$it.name]') } + ast.Block { + g.writeln('{') + g.stmts(it.stmts) + g.writeln('}') + } ast.BranchStmt { // continue or break g.write(it.tok.kind.str()) @@ -952,7 +957,7 @@ fn (g mut Gen) expr(node ast.Expr) { // TODO performance, detect `array` method differently ['repeat', 'sort_with_compare', 'free', 'push_many', 'trim', // - 'first', 'last', 'clone'] { + 'first', 'last', 'clone', 'reverse'] { // && rec_sym.name == 'array' { // && rec_sym.name == 'array' && receiver_name.starts_with('array') { // `array_byte_clone` => `array_clone`