diff options
Diffstat (limited to 'src/ast.rs')
-rw-r--r-- | src/ast.rs | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -118,7 +118,9 @@ pub enum DeclarationBody { ty: WithLocation<Ty>, }, Fun { - ty: Box<WithLocation<Ty>>, + ty: Option<WithLocation<Ty>>, + params: Vec<WithLocation<RecordField>>, + body: Box<WithLocation<Expression>>, }, } @@ -142,4 +144,18 @@ impl Declaration { } } } + + pub fn new_fun(name: WithLocation<String>, + params: Vec<WithLocation<RecordField>>, + type_: Option<WithLocation<Ty>>, + body: Box<WithLocation<Expression>>) -> Declaration { + Declaration { + name: name, + declaration: DeclarationBody::Fun { + ty: type_, + params: params, + body: body, + } + } + } } |