diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-09 11:06:37 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-09 11:26:41 +0200 |
| commit | 3932bb2cb93be95d67fc56998423eb9ce047fdfa (patch) | |
| tree | c36bd4df1d2c74f8ae100d2f3bd3a0b232b797f5 /src/eval/function.rs | |
| parent | 3c92bad9a7cd6b880de197806443ffcce2cac9d8 (diff) | |
New source loading architecture
Diffstat (limited to 'src/eval/function.rs')
| -rw-r--r-- | src/eval/function.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/eval/function.rs b/src/eval/function.rs index b9a168d2..8b1e883f 100644 --- a/src/eval/function.rs +++ b/src/eval/function.rs @@ -4,7 +4,7 @@ use std::rc::Rc; use super::{Cast, EvalContext, Value}; use crate::diag::{Error, TypResult}; -use crate::loading::FileId; +use crate::source::SourceId; use crate::syntax::{Span, Spanned}; use crate::util::EcoString; @@ -59,8 +59,8 @@ impl PartialEq for Function { /// Evaluated arguments to a function. #[derive(Debug, Clone, PartialEq)] pub struct FuncArgs { - /// The file in which the function was called. - pub file: FileId, + /// The id of the source file in which the function was called. + pub source: SourceId, /// The span of the whole argument list. pub span: Span, /// The positional arguments. @@ -103,7 +103,7 @@ impl FuncArgs { { match self.eat() { Some(found) => Ok(found), - None => bail!(self.file, self.span, "missing argument: {}", what), + None => bail!(self.source, self.span, "missing argument: {}", what), } } @@ -134,14 +134,14 @@ impl FuncArgs { let value = self.items.remove(index).value; let span = value.span; - T::cast(value).map(Some).map_err(Error::partial(self.file, span)) + T::cast(value).map(Some).map_err(Error::partial(self.source, span)) } /// Return an "unexpected argument" error if there is any remaining /// argument. pub fn finish(self) -> TypResult<()> { if let Some(arg) = self.items.first() { - bail!(self.file, arg.span, "unexpected argument"); + bail!(self.source, arg.span, "unexpected argument"); } Ok(()) } |
