mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-29 05:02:52 +03:00
fix call for immutable context, add it to test
This commit is contained in:
parent
023ae6c73d
commit
59f86c4b34
@ -71,7 +71,7 @@ impl<'a> ExpressionNode<'a> for CallExpression<'a> {
|
||||
}
|
||||
|
||||
fn is_mut_ref(&self) -> bool {
|
||||
false
|
||||
true
|
||||
}
|
||||
|
||||
fn const_value(&self) -> Option<ConstValue> {
|
||||
|
@ -3,10 +3,23 @@ circuit TestMe {
|
||||
|
||||
function test_me(mut self) -> u8 {
|
||||
self.x += 1;
|
||||
return self.x
|
||||
return self.x;
|
||||
}
|
||||
|
||||
function new() -> Self {
|
||||
return Self { x: 1u8 };
|
||||
}
|
||||
}
|
||||
|
||||
function my_fn() -> TestMe {
|
||||
return TestMe { x: 0u8 };
|
||||
}
|
||||
|
||||
function main () {
|
||||
const t = TestMe {x: 6u8}.test_me();
|
||||
console.assert(t == 7u8);
|
||||
const u = my_fn().test_me();
|
||||
console.assert(u == 1u8);
|
||||
const v = TestMe::new().test_me();
|
||||
console.assert(v == 2u8);
|
||||
}
|
Loading…
Reference in New Issue
Block a user