2012-09-11 19:46:20 -05:00
|
|
|
extern mod std;
|
2012-09-18 19:34:08 -05:00
|
|
|
use libc, sys, cast;
|
2012-09-05 14:32:05 -05:00
|
|
|
use 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-08-11 09:08:42 -05:00
|
|
|
arena: &Arena,
|
2012-03-23 17:28:47 -05:00
|
|
|
ccx: &ccx
|
|
|
|
};
|
|
|
|
|
|
|
|
type ccx = {
|
|
|
|
x: int
|
|
|
|
};
|
|
|
|
|
2012-08-20 18:53:33 -05:00
|
|
|
fn h(bcx : &r/bcx) -> &r/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-11 09:08:42 -05:00
|
|
|
let a = Arena();
|
2012-08-02 18:00:45 -05:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|