mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-02 21:44:34 +00:00
Update declare.rs
This commit is contained in:
parent
456201fb49
commit
c683049b0e
2 changed files with 10 additions and 1 deletions
|
@ -202,6 +202,12 @@ impl ASTLowerer {
|
||||||
Ok(hir::BinOp::new(binop.op, lhs, rhs, VarInfo::default()))
|
Ok(hir::BinOp::new(binop.op, lhs, rhs, VarInfo::default()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn fake_lower_unaryop(&self, unaryop: ast::UnaryOp) -> LowerResult<hir::UnaryOp> {
|
||||||
|
let mut args = unaryop.args.into_iter();
|
||||||
|
let expr = self.fake_lower_expr(*args.next().unwrap())?;
|
||||||
|
Ok(hir::UnaryOp::new(unaryop.op, expr, VarInfo::default()))
|
||||||
|
}
|
||||||
|
|
||||||
fn fake_lower_array(&self, arr: ast::Array) -> LowerResult<hir::Array> {
|
fn fake_lower_array(&self, arr: ast::Array) -> LowerResult<hir::Array> {
|
||||||
match arr {
|
match arr {
|
||||||
ast::Array::WithLength(arr) => {
|
ast::Array::WithLength(arr) => {
|
||||||
|
@ -425,6 +431,7 @@ impl ASTLowerer {
|
||||||
match expr {
|
match expr {
|
||||||
ast::Expr::Literal(lit) => Ok(hir::Expr::Lit(self.lower_literal(lit)?)),
|
ast::Expr::Literal(lit) => Ok(hir::Expr::Lit(self.lower_literal(lit)?)),
|
||||||
ast::Expr::BinOp(binop) => Ok(hir::Expr::BinOp(self.fake_lower_binop(binop)?)),
|
ast::Expr::BinOp(binop) => Ok(hir::Expr::BinOp(self.fake_lower_binop(binop)?)),
|
||||||
|
ast::Expr::UnaryOp(unop) => Ok(hir::Expr::UnaryOp(self.fake_lower_unaryop(unop)?)),
|
||||||
ast::Expr::Array(arr) => Ok(hir::Expr::Array(self.fake_lower_array(arr)?)),
|
ast::Expr::Array(arr) => Ok(hir::Expr::Array(self.fake_lower_array(arr)?)),
|
||||||
ast::Expr::Tuple(tup) => Ok(hir::Expr::Tuple(self.fake_lower_tuple(tup)?)),
|
ast::Expr::Tuple(tup) => Ok(hir::Expr::Tuple(self.fake_lower_tuple(tup)?)),
|
||||||
ast::Expr::Record(rec) => Ok(hir::Expr::Record(self.fake_lower_record(rec)?)),
|
ast::Expr::Record(rec) => Ok(hir::Expr::Record(self.fake_lower_record(rec)?)),
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
.Optional: ClassType
|
.Optional: ClassType
|
||||||
.Optional.
|
.Optional.
|
||||||
__getitem__: (Type) -> Type
|
__getitem__: (Type) -> Type
|
||||||
.Callable: (*Type) -> Type
|
.Callable: ClassType
|
||||||
|
.Callable.
|
||||||
|
__getitem__: (params: [Type; _], Type) -> Type
|
||||||
.Concatenate: (*Type) -> Type
|
.Concatenate: (*Type) -> Type
|
||||||
.Type: (Type) -> Type
|
.Type: (Type) -> Type
|
||||||
.Literal: ClassType
|
.Literal: ClassType
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue