Add back variable assignment at declaration time
This commit is contained in:
@@ -1,31 +1,29 @@
|
||||
namespace main
|
||||
|
||||
// struct Name {
|
||||
// first: cstring
|
||||
// last: cstring
|
||||
// }
|
||||
struct Name {
|
||||
first: cstring
|
||||
last: cstring
|
||||
}
|
||||
|
||||
// struct Human
|
||||
// {
|
||||
// name: Name
|
||||
// age: i64
|
||||
// }
|
||||
struct Human
|
||||
{
|
||||
name: Name
|
||||
age: i64
|
||||
}
|
||||
|
||||
export func main(args: []cstring): i64
|
||||
{
|
||||
// let x: Human
|
||||
let x: Human = alloc Human
|
||||
{
|
||||
name = alloc Name
|
||||
{
|
||||
first = "john"
|
||||
last = "doe"
|
||||
}
|
||||
age = 23
|
||||
}
|
||||
|
||||
// x = alloc Human {
|
||||
// name = alloc Name {
|
||||
// first = "john"
|
||||
// last = "doe"
|
||||
// }
|
||||
// age = 23
|
||||
// }
|
||||
|
||||
// c::puts(x.name.last)
|
||||
|
||||
c::puts("test")
|
||||
c::puts(x.name.last)
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user