fix call for immutable context, add it to test

This commit is contained in:
gluax 2021-04-15 14:34:22 -04:00
parent 023ae6c73d
commit 59f86c4b34
2 changed files with 15 additions and 2 deletions

View File

@ -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> {

View File

@ -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);
}