2012-08-02 18:00:45 -05:00
|
|
|
use std;
|
2012-03-23 17:28:47 -05:00
|
|
|
import libc, sys, unsafe;
|
2012-08-02 18:00:45 -05:00
|
|
|
import std::arena::arena;
|
2012-03-23 17:28:47 -05:00
|
|
|
|
2012-07-11 12:28:30 -05:00
|
|
|
type bcx = {
|
2012-03-23 17:28:47 -05:00
|
|
|
fcx: &fcx
|
|
|
|
};
|
|
|
|
|
2012-07-11 12:28:30 -05:00
|
|
|
type fcx = {
|
2012-03-23 17:28:47 -05:00
|
|
|
arena: &arena,
|
|
|
|
ccx: &ccx
|
|
|
|
};
|
|
|
|
|
|
|
|
type ccx = {
|
|
|
|
x: int
|
|
|
|
};
|
|
|
|
|
|
|
|
fn h(bcx : &bcx) -> &bcx {
|
2012-08-02 18:00:45 -05:00
|
|
|
return bcx.fcx.arena.alloc(|| { fcx: bcx.fcx });
|
2012-03-23 17:28:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn g(fcx : &fcx) {
|
|
|
|
let bcx = { fcx: fcx };
|
2012-08-02 18:00:45 -05:00
|
|
|
h(&bcx);
|
2012-03-23 17:28:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f(ccx : &ccx) {
|
2012-08-02 18:00:45 -05:00
|
|
|
let a = arena();
|
|
|
|
let fcx = &{ arena: &a, ccx: ccx };
|
|
|
|
return g(fcx);
|
2012-03-23 17:28:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let ccx = { x: 0 };
|
|
|
|
f(&ccx);
|
|
|
|
}
|
|
|
|
|