1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/compiler/tests/repl/chained_fields.correct.repl
Delyan Angelov 53c64abdeb compiler: make compiler an ordinary vlib/compiler module
* Move compiler/ under vlib/compiler/ .

* Add a minimal compiler/main.v driver program.

* Cleanup compiler/main.v .

* Make most compiler tests pass again.

* Apply the fix by @joe-conigliaro , so that the rest of the compiler tests are fixed too.

* Thanks to @avitkauskas, now the vlib/vcompiler/tests/str_gen_test.v test does not need to be special cased anymore.

* Reapply @joe-conigliaro fix for vgen.
2019-10-13 16:37:43 +03:00

17 lines
426 B
Plaintext

struct A { mut: v int } struct B { a A } struct C { mut: b B } struct D { mut: c C } struct E { mut: v []int } struct F { e []E }
mut b := B{} b = B{A{2}}
println('b is: ' + b.a.v.str())
mut c := C{} c.b = B{}
mut d := D{} d.c.b = B{}
f := F{[E{[10,20,30]},E{[100,200,300,400]}]}
println('f.e[0].v.len: ${f.e[0].v.len}')
println('f.e[1].v.len: ${f.e[1].v.len}')
===output===
b is: 2
f.e[0].v.len: 3
f.e[1].v.len: 4