mirror of https://github.com/stelzo/typst.git
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…
Reference in New Issue