summaryrefslogtreecommitdiff
path: root/dhall_syntax/src/core/expr.rs
diff options
context:
space:
mode:
authorNadrieril2019-11-11 11:20:32 +0000
committerNadrieril2019-11-11 13:50:36 +0000
commitb68c3af578d1f6b0d1e32e7d88ef57774fb468d8 (patch)
treed35a77d82657928e817fa2541edb6dcbe8455266 /dhall_syntax/src/core/expr.rs
parenta8cb6926cbafb2ac806f7bec27a29b0528ed5056 (diff)
Capture absence of span in Span itself
Diffstat (limited to '')
-rw-r--r--dhall_syntax/src/core/expr.rs18
1 files changed, 4 insertions, 14 deletions
diff --git a/dhall_syntax/src/core/expr.rs b/dhall_syntax/src/core/expr.rs
index 70ce1dc..750b58b 100644
--- a/dhall_syntax/src/core/expr.rs
+++ b/dhall_syntax/src/core/expr.rs
@@ -1,4 +1,3 @@
-
use crate::map::{DupTreeMap, DupTreeSet};
use crate::visitor::{self, ExprFMutVisitor, ExprFVisitor};
use crate::*;
@@ -143,7 +142,7 @@ pub enum Builtin {
// Each node carries an annotation.
#[derive(Debug, Clone)]
-pub struct Expr<Embed>(Box<(RawExpr<Embed>, Option<Span>)>);
+pub struct Expr<Embed>(Box<(RawExpr<Embed>, Span)>);
pub type RawExpr<Embed> = ExprF<Expr<Embed>, Embed>;
@@ -299,16 +298,12 @@ impl<E> Expr<E> {
pub fn as_mut(&mut self) -> &mut RawExpr<E> {
&mut self.0.as_mut().0
}
- pub fn span(&self) -> Option<Span> {
+ pub fn span(&self) -> Span {
self.0.as_ref().1.clone()
}
- pub(crate) fn new(x: RawExpr<E>, n: Span) -> Self {
- Expr(Box::new((x, Some(n))))
- }
-
- pub fn from_expr_no_span(x: RawExpr<E>) -> Self {
- Expr(Box::new((x, None)))
+ pub fn new(x: RawExpr<E>, n: Span) -> Self {
+ Expr(Box::new((x, n)))
}
pub fn rewrap<E2>(&self, x: RawExpr<E2>) -> Expr<E2> {
@@ -353,11 +348,6 @@ impl<E> Expr<E> {
}
}
-// Should probably rename this
-pub fn rc<E>(x: RawExpr<E>) -> Expr<E> {
- Expr::from_expr_no_span(x)
-}
-
/// Add an isize to an usize
/// Panics on over/underflow
fn add_ui(u: usize, i: isize) -> Option<usize> {