mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Check cyclic-import when importing package (#4737)
This commit is contained in:
parent
324c937dcd
commit
3dbaf3a4ca
@ -182,6 +182,12 @@ fn import_package(vm: &mut Vm, spec: PackageSpec, span: Span) -> SourceResult<Mo
|
||||
// Evaluate the entry point.
|
||||
let entrypoint_id = manifest_id.join(&manifest.package.entrypoint);
|
||||
let source = vm.world().source(entrypoint_id).at(span)?;
|
||||
|
||||
// Prevent cyclic importing.
|
||||
if vm.engine.route.contains(source.id()) {
|
||||
bail!(span, "cyclic import");
|
||||
}
|
||||
|
||||
let point = || Tracepoint::Import;
|
||||
Ok(eval(
|
||||
vm.world(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user