Skip to content

Commit

Permalink
explicit return for now
Browse files Browse the repository at this point in the history
  • Loading branch information
edg-l committed Jan 5, 2024
1 parent cc657bc commit 8a5dacd
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion crates/concrete_ast/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{
common::{DocString, Ident},
types::TypeSpec, expressions::Expression,
expressions::Expression,
types::TypeSpec,
};

#[derive(Clone, Debug, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion crates/concrete_ast/src/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub enum Expression {
}

pub struct BlockExpr {
pub statements: Vec<Statement>
pub statements: Vec<Statement>,
}

#[derive(Clone, Debug, PartialEq)]
Expand Down
4 changes: 2 additions & 2 deletions crates/concrete_ast/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pub mod common;
pub mod constants;
pub mod operations;
pub mod expressions;
pub mod functions;
pub mod imports;
pub mod modules;
pub mod operations;
pub mod statements;
pub mod structs;
pub mod types;
pub mod expressions;
3 changes: 2 additions & 1 deletion crates/concrete_ast/src/statements.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::{
common::Ident,
expressions::{Expression, MatchExpr},
operations::{Operation, PathOp},
types::TypeSpec, expressions::{Expression, MatchExpr},
types::TypeSpec,
};

#[derive(Clone, Debug, PartialEq)]
Expand Down
4 changes: 2 additions & 2 deletions crates/concrete_parser/src/grammar.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@ pub(crate) FnCallOp: ast::operations::FnCallOp = {
// -- Statements

pub(crate) Statement: ast::statements::Statement = {
//<MatchExpr> => ast::statements::Statement::Match(<>),
<MatchExpr> ";" => ast::statements::Statement::Match(<>),
<ReturnStmt> => ast::statements::Statement::Return(<>),
}

pub(crate) ReturnStmt: ast::statements::ReturnStmt = {
"return"? <value:Expression> => ast::statements::ReturnStmt {
"return" <value:Expression> => ast::statements::ReturnStmt {
value,
},
}
4 changes: 2 additions & 2 deletions crates/concrete_parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ mod ModuleName {
let source = r##"mod FactorialModule {
pub fn factorial(x: u64) -> u64 {
return match x {
0 -> 1,
n -> n * factorial(n-1),
0 -> return 1,
n -> return n * factorial(n-1),
};
}
}"##;
Expand Down

0 comments on commit 8a5dacd

Please sign in to comment.