Fix linker cyclical fields checker
This commit is contained in:
parent
c84954480b
commit
3cd4121951
@ -1,3 +1,6 @@
|
|||||||
import triple_import_vec2::Vec2;
|
import triple_import_vec2::Vec2;
|
||||||
|
|
||||||
struct Ship { position: Vec2 }
|
struct Ship {
|
||||||
|
position: Vec2,
|
||||||
|
velocity: Vec2,
|
||||||
|
}
|
@ -447,7 +447,7 @@ impl<'map> Pass for LinkerPass<'map> {
|
|||||||
&inner_ty,
|
&inner_ty,
|
||||||
importer_module.module_id,
|
importer_module.module_id,
|
||||||
&modules,
|
&modules,
|
||||||
&mut HashSet::new(),
|
HashSet::new(),
|
||||||
) {
|
) {
|
||||||
Ok(ty) => ty,
|
Ok(ty) => ty,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@ -475,14 +475,14 @@ impl<'map> Pass for LinkerPass<'map> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let resolved =
|
let resolved = match resolve_types_recursively(&ty, importer_module.module_id, &modules, HashSet::new())
|
||||||
match resolve_types_recursively(&ty, importer_module.module_id, &modules, &mut HashSet::new()) {
|
{
|
||||||
Ok(ty) => ty,
|
Ok(ty) => ty,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
state.note_errors(&vec![e], meta);
|
state.note_errors(&vec![e], meta);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
imported_types.extend(resolved);
|
imported_types.extend(resolved);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -664,7 +664,7 @@ fn resolve_types_recursively(
|
|||||||
ty: &CustomTypeKey,
|
ty: &CustomTypeKey,
|
||||||
resolver: SourceModuleId,
|
resolver: SourceModuleId,
|
||||||
modules: &HashMap<SourceModuleId, LinkerModule>,
|
modules: &HashMap<SourceModuleId, LinkerModule>,
|
||||||
seen: &mut HashSet<CustomTypeKey>,
|
mut seen: HashSet<CustomTypeKey>,
|
||||||
) -> Result<HashMap<CustomTypeKey, SourceModuleId>, ErrorKind> {
|
) -> Result<HashMap<CustomTypeKey, SourceModuleId>, ErrorKind> {
|
||||||
let resolved_ty = resolve_type(ty, modules)?;
|
let resolved_ty = resolve_type(ty, modules)?;
|
||||||
|
|
||||||
@ -691,7 +691,7 @@ fn resolve_types_recursively(
|
|||||||
for field in fields {
|
for field in fields {
|
||||||
match &field.1 {
|
match &field.1 {
|
||||||
TypeKind::CustomType(ty_key) => {
|
TypeKind::CustomType(ty_key) => {
|
||||||
types.extend(resolve_types_recursively(ty_key, resolved_ty.1, modules, seen)?);
|
types.extend(resolve_types_recursively(ty_key, resolved_ty.1, modules, seen.clone())?);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user