diff options
author | Greg Brown <gmb60@cam.ac.uk> | 2021-01-09 11:53:21 +0000 |
---|---|---|
committer | Greg Brown <gmb60@cam.ac.uk> | 2021-01-09 11:53:21 +0000 |
commit | 487ce4fe0fa081f58d790d7d6417bf7d2659197c (patch) | |
tree | 435dbca41a6a8c67eac0fd875599103c611349bb /src/chomp/ast.rs | |
parent | ae1511dc11236601da174a146b1713b9d68ddc30 (diff) |
Make all ast spans optional.
Diffstat (limited to 'src/chomp/ast.rs')
-rw-r--r-- | src/chomp/ast.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/chomp/ast.rs b/src/chomp/ast.rs index 58d76c9..76d75ae 100644 --- a/src/chomp/ast.rs +++ b/src/chomp/ast.rs @@ -262,7 +262,7 @@ pub struct Parameter { } impl Parameter { - pub fn new(name: Name, index: usize) -> Self { + pub const fn new(name: Name, index: usize) -> Self { Self { name, index } } @@ -288,17 +288,17 @@ impl Display for Parameter { /// A macro invocation. #[derive(Clone, Debug)] pub struct Call { - pub name: Ident, + pub name: Name, pub args: Vec<Expression>, pub span: Option<Span>, } impl Call { - pub fn new(name: Ident, args: Vec<Expression>, span: Option<Span>) -> Self { + pub fn new(name: Name, args: Vec<Expression>, span: Option<Span>) -> Self { Self { name, args, span } } - pub fn name(&self) -> &Ident { + pub fn name(&self) -> &Name { &self.name } @@ -487,14 +487,14 @@ impl From<Call> for Expression { #[derive(Clone, Debug)] pub struct Function { - pub name: Ident, + pub name: Name, pub params: usize, pub expr: Expression, pub span: Option<Span>, } impl Function { - pub const fn new(name: Ident, params: usize, expr: Expression, span: Option<Span>) -> Self { + pub const fn new(name: Name, params: usize, expr: Expression, span: Option<Span>) -> Self { Self { name, params, |