vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.5k stars 2.15k forks source link

cgen: fix dumping array of reference (fix #21690) #21694

Closed yuyi98 closed 1 week ago

yuyi98 commented 1 week ago

This PR fix dumping array of reference (fix #21690).

struct Balise {
    a int
}

fn escape_tag(mut parents []Balise) {
    dump(parents)
    mut stack := []&Balise{}
    stack << &Balise{10}
    stack << &Balise{20}
    dump(stack)
}

fn main() {
    mut bal := [Balise{11}, Balise{22}]
    escape_tag(mut bal)
}

PS D:\Test\v\tt1> v run .
[.\\tt1.v:6] parents: &[Balise{
    a: 11
}, Balise{
    a: 22
}]
[.\\tt1.v:10] stack: [&Balise{
    a: 10
}, &Balise{
    a: 20
}]
medvednikov commented 1 week ago

Thanks @yuyi98, good to have you back :)