diff options
Diffstat (limited to 'src/syntax')
| -rw-r--r-- | src/syntax/ast/expr.rs | 2 | ||||
| -rw-r--r-- | src/syntax/span.rs | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/syntax/ast/expr.rs b/src/syntax/ast/expr.rs index 4f440d33..433dcca2 100644 --- a/src/syntax/ast/expr.rs +++ b/src/syntax/ast/expr.rs @@ -21,7 +21,7 @@ pub struct ExprCall { /// The name of the function. pub name: Spanned<Ident>, /// The arguments to the function. - pub args: LitDict, + pub args: Spanned<LitDict>, } /// A unary operation: `-x`. diff --git a/src/syntax/span.rs b/src/syntax/span.rs index e9e1021c..6ba9c44a 100644 --- a/src/syntax/span.rs +++ b/src/syntax/span.rs @@ -40,7 +40,7 @@ impl<T> Offset for SpanVec<T> { } /// A value with the span it corresponds to in the source code. -#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] #[cfg_attr(feature = "serialize", derive(serde::Serialize))] pub struct Spanned<T> { /// The spanned value. @@ -178,6 +178,12 @@ impl PartialEq for Span { } } +impl Default for Span { + fn default() -> Self { + Span::ZERO + } +} + impl<T> From<T> for Span where T: Into<Pos> + Copy, @@ -229,6 +235,12 @@ impl From<u32> for Pos { } } +impl From<i32> for Pos { + fn from(index: i32) -> Self { + Self(index as u32) + } +} + impl From<usize> for Pos { fn from(index: usize) -> Self { Self(index as u32) |
