mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-11 04:49:15 +03:00
Add support for self.parent
This commit is contained in:
parent
e820f7fae2
commit
4abec6b5fc
@ -116,6 +116,16 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
||||
))
|
||||
}
|
||||
return Some(Type::Address);
|
||||
},
|
||||
sym::parent => {
|
||||
// Check that operation is not invoked in a `finalize` block.
|
||||
if self.is_finalize {
|
||||
self.handler.emit_err(TypeCheckerError::invalid_operation_inside_finalize(
|
||||
"self.parent",
|
||||
access.name.span(),
|
||||
))
|
||||
}
|
||||
return Some(Type::Address)
|
||||
}
|
||||
_ => {
|
||||
self.emit_err(TypeCheckerError::invalid_self_access(access.name.span()));
|
||||
|
@ -252,6 +252,7 @@ symbols! {
|
||||
main,
|
||||
mapping,
|
||||
Mut: "mut",
|
||||
parent,
|
||||
Return: "return",
|
||||
SelfLower: "self",
|
||||
SelfUpper: "Self",
|
||||
|
@ -387,7 +387,7 @@ create_messages!(
|
||||
@formatted
|
||||
invalid_self_access {
|
||||
args: (),
|
||||
msg: format!("The allowed accesses to `self` are `self.caller`."),
|
||||
msg: format!("The allowed accesses to `self` are `self.caller` and `self.parent`."),
|
||||
help: None,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user