mirror of
https://github.com/typst/typst
synced 2025-08-24 11:44:12 +08:00
docs: update some comments
This commit is contained in:
parent
0e8c2e080d
commit
80491a459c
@ -151,7 +151,7 @@ pub struct Warned<T> {
|
|||||||
pub warnings: EcoVec<SourceDiagnostic>,
|
pub warnings: EcoVec<SourceDiagnostic>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An error or warning in a source file.
|
/// An error or warning in a source or text file.
|
||||||
///
|
///
|
||||||
/// The contained spans will only be detached if any of the input source files
|
/// The contained spans will only be detached if any of the input source files
|
||||||
/// were detached.
|
/// were detached.
|
||||||
@ -574,8 +574,11 @@ impl From<PackageError> for EcoString {
|
|||||||
pub type LoadResult<T> = Result<T, LoadError>;
|
pub type LoadResult<T> = Result<T, LoadError>;
|
||||||
|
|
||||||
/// A callsite independent error that occurred during data loading.
|
/// A callsite independent error that occurred during data loading.
|
||||||
|
/// This avoids polluting the memoization with [`Span`]s and [`FileId`]s from source files.
|
||||||
/// Can be turned into a [`SourceDiagnostic`] using the [`LoadedAt::in_text`]
|
/// Can be turned into a [`SourceDiagnostic`] using the [`LoadedAt::in_text`]
|
||||||
/// or [`LoadedAt::in_invalid_text`] methods available on [`LoadResult`].
|
/// or [`LoadedAt::in_invalid_text`] methods available on [`LoadResult`].
|
||||||
|
///
|
||||||
|
/// [`FileId`]: typst_syntax::FileId
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||||
pub struct LoadError {
|
pub struct LoadError {
|
||||||
pub pos: ReportPos,
|
pub pos: ReportPos,
|
||||||
|
@ -307,7 +307,6 @@ impl Bibliography {
|
|||||||
#[typst_macros::time(name = "load bibliography")]
|
#[typst_macros::time(name = "load bibliography")]
|
||||||
fn decode(data: &[Loaded]) -> SourceResult<Bibliography> {
|
fn decode(data: &[Loaded]) -> SourceResult<Bibliography> {
|
||||||
let mut map = IndexMap::new();
|
let mut map = IndexMap::new();
|
||||||
// TODO: store spans of entries for duplicate key error messages
|
|
||||||
let mut duplicates = Vec::<EcoString>::new();
|
let mut duplicates = Vec::<EcoString>::new();
|
||||||
|
|
||||||
// We might have multiple bib/yaml files
|
// We might have multiple bib/yaml files
|
||||||
@ -326,8 +325,9 @@ impl Bibliography {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !duplicates.is_empty() {
|
if !duplicates.is_empty() {
|
||||||
// TODO: errors with spans of source files,
|
// TODO: Store spans of entries for duplicate key error messages.
|
||||||
// requires hayagriva entries to store the range
|
// Requires hayagriva entries to store their location, which should
|
||||||
|
// be fine, since they are 1kb anyway.
|
||||||
let span = data.first().unwrap().source.span;
|
let span = data.first().unwrap().source.span;
|
||||||
bail!(span, "duplicate bibliography keys: {}", duplicates.join(", "));
|
bail!(span, "duplicate bibliography keys: {}", duplicates.join(", "));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user