From 487ce4fe0fa081f58d790d7d6417bf7d2659197c Mon Sep 17 00:00:00 2001 From: Greg Brown Date: Sat, 9 Jan 2021 11:53:21 +0000 Subject: Make all ast spans optional. --- src/chomp/ast.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/chomp/ast.rs') 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, pub span: Option, } impl Call { - pub fn new(name: Ident, args: Vec, span: Option) -> Self { + pub fn new(name: Name, args: Vec, span: Option) -> Self { Self { name, args, span } } - pub fn name(&self) -> &Ident { + pub fn name(&self) -> &Name { &self.name } @@ -487,14 +487,14 @@ impl From for Expression { #[derive(Clone, Debug)] pub struct Function { - pub name: Ident, + pub name: Name, pub params: usize, pub expr: Expression, pub span: Option, } impl Function { - pub const fn new(name: Ident, params: usize, expr: Expression, span: Option) -> Self { + pub const fn new(name: Name, params: usize, expr: Expression, span: Option) -> Self { Self { name, params, -- cgit v1.2.3