rue_compiler/compile/
ty.rs1mod group;
2mod lambda;
3mod list;
4mod literal;
5mod pair;
6mod path;
7mod union;
8
9pub use group::*;
10pub use lambda::*;
11pub use list::*;
12pub use literal::*;
13pub use pair::*;
14pub use path::*;
15pub use union::*;
16
17use rue_ast::{AstNode, AstType};
18use rue_types::TypeId;
19
20use crate::{Compiler, CompletionContext, SyntaxItemKind};
21
22pub fn compile_type(ctx: &mut Compiler, ty: &AstType) -> TypeId {
23 ctx.add_syntax(
24 SyntaxItemKind::CompletionContext(CompletionContext::Type),
25 ty.syntax().text_range(),
26 );
27
28 match ty {
29 AstType::PathType(path) => compile_path_type(ctx, path),
30 AstType::UnionType(union) => compile_union_type(ctx, union),
31 AstType::GroupType(group) => compile_group_type(ctx, group),
32 AstType::PairType(pair) => compile_pair_type(ctx, pair),
33 AstType::ListType(list) => compile_list_type(ctx, list),
34 AstType::LiteralType(literal) => compile_literal_type(ctx, literal),
35 AstType::LambdaType(lambda) => compile_lambda_type(ctx, lambda),
36 }
37}