From 72a9631b038d1a60e4e4a78e92cd69e6f8ce4316 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 5 Dec 2019 19:48:37 +0100 Subject: =?UTF-8?q?Move=20arg=20parser=20into=20`FuncArgs`=20and=20create?= =?UTF-8?q?=20(incomplete)=20consistent=20map=20=F0=9F=A7=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/span.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/syntax/span.rs') diff --git a/src/syntax/span.rs b/src/syntax/span.rs index aa494224..9e018437 100644 --- a/src/syntax/span.rs +++ b/src/syntax/span.rs @@ -5,27 +5,27 @@ use std::fmt::{self, Display, Formatter}; /// Annotates a value with the part of the source code it corresponds to. #[derive(Copy, Clone, Eq, PartialEq)] pub struct Spanned { - pub val: T, + pub v: T, pub span: Span, } impl Spanned { - pub fn new(val: T, span: Span) -> Spanned { - Spanned { val, span } + pub fn new(v: T, span: Span) -> Spanned { + Spanned { v, span } } pub fn value(self) -> T { - self.val + self.v } - pub fn span_map(self, f: F) -> Spanned where F: FnOnce(T) -> U { - Spanned::new(f(self.val), self.span) + pub fn map(self, f: F) -> Spanned where F: FnOnce(T) -> U { + Spanned::new(f(self.v), self.span) } } impl Display for Spanned where T: std::fmt::Debug { fn fmt(&self, f: &mut Formatter) -> fmt::Result { - write!(f, "({:?}:{})", self.val, self.span) + write!(f, "({:?}:{})", self.v, self.span) } } -- cgit v1.2.3