leo/tests/pass/parse/circuits/member_function_nested.leo

19 lines
295 B
Plaintext
Raw Normal View History

2021-03-03 20:59:24 +03:00
circuit Foo {
x: u32,
function add_x(self, y: u32) -> u32 {
return self.x + y
}
function call_add_x(self, y: u32) -> u32 {
return self.add_x(y)
}
}
function main() {
let a = Foo { x: 1u32 };
let b = a.add_x(1u32);
console.assert(b == 2u32);
}