leo/asg/tests/pass/circuits/member_function_nested.leo

19 lines
301 B
Plaintext
Raw Normal View History

2021-01-25 18:17:42 +03:00
circuit Foo {
x: u32;
2021-01-25 18:17:42 +03:00
function add_x(self, y: u32) -> u32 {
return self.x + y;
2021-01-25 18:17:42 +03:00
}
function call_add_x(self, y: u32) -> u32 {
return self.add_x(y);
2021-01-25 18:17:42 +03:00
}
}
function main() {
const a = Foo { x: 1u32 };
const b = a.add_x(1u32);
2021-01-25 18:17:42 +03:00
console.assert(b == 2u32);
}