rue_compiler/compile/ty/
path.rs

1use log::debug;
2use rue_ast::{AstNode, AstPathType};
3use rue_hir::Declaration;
4use rue_types::TypeId;
5
6use crate::{Compiler, PathKind, PathResult, compile_path};
7
8pub fn compile_path_type(ctx: &mut Compiler, path: &AstPathType) -> TypeId {
9    let PathResult::Type(ty) = compile_path(ctx, path.syntax(), path.segments(), PathKind::Type)
10    else {
11        debug!("Unresolved path type {}", path.syntax().text());
12        return ctx.builtins().unresolved.ty;
13    };
14
15    ctx.reference(Declaration::Type(ty));
16
17    ty
18}