pub struct Compiler { /* private fields */ }Implementations§
Source§impl Compiler
impl Compiler
pub fn new(options: CompilerOptions) -> Self
pub fn source(&self) -> &Source
pub fn options(&self) -> &CompilerOptions
pub fn set_source(&mut self, source: Source)
pub fn scope_stack(&self) -> Vec<ScopeId> ⓘ
pub fn syntax_map(&self) -> &SyntaxMap
pub fn add_syntax(&mut self, kind: SyntaxItemKind, span: TextRange)
pub fn add_syntax_for_source( &mut self, kind: SyntaxItemKind, span: TextRange, source_kind: SourceKind, )
pub fn take_diagnostics(&mut self) -> Vec<Diagnostic>
pub fn builtins(&self) -> &Builtins
pub fn diagnostic(&mut self, node: &impl GetTextRange, kind: DiagnosticKind)
pub fn diagnostic_name(&mut self, name: &Name, kind: DiagnosticKind)
pub fn diagnostic_at(&mut self, srcloc: SrcLoc, kind: DiagnosticKind)
pub fn srcloc(&self, node: &impl GetTextRange) -> SrcLoc
pub fn local_name(&self, token: &SyntaxToken) -> Name
pub fn extend_diagnostics(&mut self, diagnostics: Vec<Diagnostic>)
pub fn alloc_child_scope(&mut self) -> ScopeId
pub fn push_scope(&mut self, scope: ScopeId, start: TextSize)
pub fn pop_scope(&mut self, end: TextSize)
pub fn last_scope(&self) -> &Scope
pub fn last_scope_mut(&mut self) -> &mut Scope
pub fn last_scope_id(&self) -> ScopeId
pub fn push_module(&mut self, module: SymbolId)
pub fn pop_module(&mut self)
pub fn parent_module_stack(&self) -> &[SymbolId] ⓘ
pub fn resolve_symbol_in( &self, scope: ScopeId, name: &str, ) -> Option<(SymbolId, Option<ImportId>)>
pub fn resolve_type_in( &self, scope: ScopeId, name: &str, ) -> Option<(TypeId, Option<ImportId>)>
pub fn type_name(&mut self, ty: TypeId) -> String
pub fn type_name_in(&mut self, scope: ScopeId, ty: TypeId) -> String
pub fn symbol_name(&self, symbol: SymbolId) -> String
pub fn symbol_type(&self, symbol: SymbolId) -> TypeId
pub fn symbol_type_in(&self, scope: ScopeId, symbol: SymbolId) -> TypeId
pub fn push_mappings( &mut self, mappings: HashMap<SymbolId, HashMap<Vec<TypePath>, TypeId>>, start: TextSize, ) -> usize
pub fn mapping_checkpoint(&self) -> usize
pub fn revert_mappings(&mut self, index: usize, end: TextSize)
pub fn is_assignable(&mut self, from: TypeId, to: TypeId) -> bool
pub fn is_castable(&mut self, from: TypeId, to: TypeId) -> bool
pub fn assign_type( &mut self, node: &impl GetTextRange, from: TypeId, to: TypeId, )
pub fn cast_type(&mut self, node: &impl GetTextRange, from: TypeId, to: TypeId)
pub fn guard_type( &mut self, node: &impl GetTextRange, from: TypeId, to: TypeId, ) -> Constraint
pub fn check_condition(&mut self, node: &impl GetTextRange, ty: TypeId)
pub fn infer_type( &mut self, node: &impl GetTextRange, from: TypeId, to: TypeId, infer: &mut HashMap<TypeId, Vec<TypeId>>, )
pub fn insert_default_field(&mut self, ty: TypeId, name: String, value: Value)
pub fn default_field(&self, ty: TypeId, name: &str) -> Option<Value>
pub fn push_declaration(&mut self, declaration: Declaration)
pub fn pop_declaration(&mut self)
pub fn reference(&mut self, reference: Declaration, import: Option<ImportId>)
pub fn declaration_span(&mut self, declaration: Declaration, span: TextRange)
pub fn reference_span(&mut self, reference: Declaration, span: TextRange)
pub fn is_unresolved(&mut self, ty: TypeId) -> bool
Methods from Deref<Target = Database>§
pub fn alloc_hir(&mut self, hir: Hir) -> Id<Hir>
pub fn hir(&self, id: Id<Hir>) -> &Hir
pub fn hir_mut(&mut self, id: Id<Hir>) -> &mut Hir
pub fn alloc_scope(&mut self, scope: Scope) -> Id<Scope>
pub fn scope(&self, id: Id<Scope>) -> &Scope
pub fn scope_mut(&mut self, id: Id<Scope>) -> &mut Scope
pub fn alloc_import(&mut self, import: Import) -> Id<Import>
pub fn import(&self, id: Id<Import>) -> &Import
pub fn import_mut(&mut self, id: Id<Import>) -> &mut Import
pub fn alloc_symbol(&mut self, symbol: Symbol) -> Id<Symbol>
pub fn symbol(&self, id: Id<Symbol>) -> &Symbol
pub fn symbol_mut(&mut self, id: Id<Symbol>) -> &mut Symbol
pub fn module(&self, id: Id<Symbol>) -> &ModuleSymbol
pub fn module_mut(&mut self, id: Id<Symbol>) -> &mut ModuleSymbol
pub fn alloc_type(&mut self, ty: Type) -> Id<Type>
pub fn ty(&self, id: Id<Type>) -> &Type
pub fn ty_mut(&mut self, id: Id<Type>) -> &mut Type
pub fn types(&self) -> &Arena<Type>
pub fn types_mut(&mut self) -> &mut Arena<Type>
pub fn add_relevant_declaration(&mut self, declaration: Declaration)
pub fn relevant_declarations(&self) -> impl Iterator<Item = Declaration>
pub fn add_reference(&mut self, outer: Declaration, inner: Declaration)
pub fn add_declaration(&mut self, outer: Declaration, inner: Declaration)
pub fn reference_parents(&self, declaration: Declaration) -> Vec<Declaration>
pub fn declaration_parents(&self, declaration: Declaration) -> Vec<Declaration>
pub fn add_relevant_import(&mut self, import: Id<Import>)
pub fn relevant_imports(&self) -> impl Iterator<Item = Id<Import>>
pub fn add_import_reference( &mut self, import: Id<Import>, declaration: Declaration, )
pub fn import_references(&self, import: Id<Import>) -> Vec<Declaration>
pub fn add_test(&mut self, test: Test)
pub fn tests(&self) -> impl Iterator<Item = &Test>
pub fn debug_symbol(&self, id: Id<Symbol>) -> String
pub fn debug_hir(&self, id: Id<Hir>) -> String
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Compiler
impl RefUnwindSafe for Compiler
impl Send for Compiler
impl Sync for Compiler
impl Unpin for Compiler
impl UnwindSafe for Compiler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.