Skip to content

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

Merged
spytheman merged 1 commit into
vlang:masterfrom
yuyi98:fix_dump_array_val
Jun 18, 2024
Merged

spytheman merged 1 commit into
vlang:masterfrom
yuyi98:fix_dump_array_val

Conversation

@yuyi98

@yuyi98 yuyi98 commented Jun 18, 2024 •

Copy link
Copy Markdown
Member

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

  • Fix dumping array of reference.
  • Add test.
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
}]

@yuyi98 yuyi98 changed the title cgen: fix dumping array of reference cgen: fix dumping array of reference (fix #21690) Jun 18, 2024

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman
spytheman merged commit de5ad8b into vlang:master Jun 18, 2024
@yuyi98
yuyi98 deleted the fix_dump_array_val branch June 18, 2024 11:53
@medvednikov

Copy link
Copy Markdown
Member

Thanks @yuyi98, good to have you back :)

raw-bin pushed a commit to raw-bin/v that referenced this pull request Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

builder error: cannot convert 'struct array' to 'struct array *'

3 participants