Set parent_node and always copy datatype when assigned to code nodes.

This is a delicate patch that fixes subtle memory corruption bugs in
libvala users and the compiler itself.
It might break some application, so this commit is open for testing.