mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 02:39:20 +00:00
feat: support using attributes in predicate
This commit is contained in:
parent
47818e431e
commit
0bedeb51ab
6 changed files with 194 additions and 21 deletions
|
@ -1577,6 +1577,10 @@ impl Context {
|
|||
self.inc_ref_local(local, self, tmp_tv_cache);
|
||||
Ok(Predicate::Const(local.inspect().clone()))
|
||||
}
|
||||
ast::ConstExpr::Accessor(ast::ConstAccessor::Attr(attr)) => {
|
||||
let obj = self.instantiate_const_expr(&attr.obj, None, tmp_tv_cache, false)?;
|
||||
Ok(Predicate::attr(obj, attr.name.inspect().clone()))
|
||||
}
|
||||
ast::ConstExpr::App(app) => {
|
||||
let receiver = self.instantiate_const_expr(&app.obj, None, tmp_tv_cache, false)?;
|
||||
let name = app.attr_name.as_ref().map(|n| n.inspect().to_owned());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue