2020-07-04 08:44:09 +03:00
|
|
|
circuit Foo {
|
|
|
|
x: u32,
|
|
|
|
|
2020-12-01 19:54:51 +03:00
|
|
|
function add_x(self, y: u32) -> u32 {
|
2021-04-14 23:59:07 +03:00
|
|
|
return self.x + y;
|
2020-07-04 08:44:09 +03:00
|
|
|
}
|
|
|
|
|
2020-12-01 19:54:51 +03:00
|
|
|
function call_add_x(self, y: u32) -> u32 {
|
2021-04-14 23:59:07 +03:00
|
|
|
return self.add_x(y);
|
2020-07-04 08:44:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-30 21:11:54 +03:00
|
|
|
function main() {
|
2021-03-18 22:19:07 +03:00
|
|
|
const a = Foo { x: 1u32 };
|
|
|
|
const b = a.add_x(1u32);
|
2020-07-04 08:44:09 +03:00
|
|
|
|
2020-08-17 03:20:47 +03:00
|
|
|
console.assert(b == 2u32);
|
2020-07-04 08:44:09 +03:00
|
|
|
}
|