Add function call expressions

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-05-06 17:39:31 -04:00
parent bd87e9dd30
commit 5c505e5ae5
2 changed files with 105 additions and 2 deletions

View File

@@ -22,9 +22,10 @@ impl Spanned for AssignStmt {
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Expr {
Base(BaseExpr),
Bin(Box<BinExpr>),
Un(Box<UnExpr>),
FunCall(Box<FunCallExpr>),
Base(BaseExpr),
}
impl Spanned for Expr {
@@ -33,6 +34,7 @@ impl Spanned for Expr {
Expr::Base(b) => b.span(),
Expr::Bin(b) => b.span(),
Expr::Un(u) => u.span(),
Expr::FunCall(f) => f.span(),
}
}
}
@@ -86,6 +88,21 @@ impl Spanned for UnExpr {
}
}
#[derive(Derivative, Clone, PartialEq, Eq)]
#[derivative(Debug)]
pub struct FunCallExpr {
pub expr: Expr,
pub args: Vec<Expr>,
#[derivative(Debug = "ignore")]
pub span: Span,
}
impl Spanned for FunCallExpr {
fn span(&self) -> Span {
self.span
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum BaseExprKind {
Ident,