Carry source spans for error messages

This commit is contained in:
Joscha 2021-11-29 11:14:48 +00:00
parent 1d80ab681e
commit 1170009b4f
6 changed files with 132 additions and 59 deletions

View file

@ -1,6 +1,6 @@
use chrono::NaiveDate;
use crate::files::commands::{self, DoneDate, Time};
use crate::files::commands::{self, DoneDate, Spanned, Time};
use crate::files::Source;
use super::delta::{Delta, DeltaStep};
@ -29,7 +29,9 @@ impl From<&commands::DateSpec> for DateSpec {
.map(|delta| delta.into())
.unwrap_or_default();
if let Some(time) = spec.end_time {
end_delta.steps.push(DeltaStep::Time(time));
end_delta
.steps
.push(Spanned::new(time.span, DeltaStep::Time(time.value)));
}
let repeat: Option<Delta> = spec.repeat.as_ref().map(|repeat| (&repeat.delta).into());