Block/scope parsing.
This commit is contained in:
+13
@@ -5,6 +5,7 @@ pub enum Stmt {
|
||||
Let(Let),
|
||||
Assign(Assign),
|
||||
Expr(Expr),
|
||||
Block(Block),
|
||||
Fn(FnDef),
|
||||
}
|
||||
|
||||
@@ -26,6 +27,12 @@ impl From<Expr> for Stmt {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Block> for Stmt {
|
||||
fn from(block: Block) -> Self {
|
||||
Stmt::Block(block)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FnDef> for Stmt {
|
||||
fn from(fn_def: FnDef) -> Self {
|
||||
Stmt::Fn(fn_def)
|
||||
@@ -55,6 +62,12 @@ pub struct FnDef {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Block {
|
||||
pub stmts: Vec<Stmt>,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct FnParam {
|
||||
pub name: Ident,
|
||||
|
||||
Reference in New Issue
Block a user