pub(super) struct Elaborator {
pub(super) program: Program,
pub(super) templates: BTreeMap<String, StructTemplate>,
pub(super) enum_templates: BTreeMap<String, EnumTemplate>,
pub(super) signatures: BTreeMap<String, FunctionSig>,
pub(super) function_templates: BTreeMap<String, RuntimeFunctionTemplate>,
pub(super) specializations: BTreeMap<SpecializationKey, String>,
pub(super) concrete_structs: BTreeMap<String, StructDecl>,
pub(super) instantiating_structs: BTreeSet<String>,
pub(super) instantiating_functions: BTreeSet<SpecializationKey>,
pub(super) next_function_instance_id: usize,
pub(super) pass_timings: Vec<PassTiming>,
}Fields§
§program: Program§templates: BTreeMap<String, StructTemplate>§enum_templates: BTreeMap<String, EnumTemplate>§signatures: BTreeMap<String, FunctionSig>§function_templates: BTreeMap<String, RuntimeFunctionTemplate>§specializations: BTreeMap<SpecializationKey, String>§concrete_structs: BTreeMap<String, StructDecl>§instantiating_structs: BTreeSet<String>§instantiating_functions: BTreeSet<SpecializationKey>§next_function_instance_id: usize§pass_timings: Vec<PassTiming>Implementations§
Source§impl Elaborator
impl Elaborator
Sourcepub(super) fn bind_template_call_args(
&mut self,
callee_name: &str,
template: &RuntimeFunctionTemplate,
args: &mut Vec<CallArg>,
locals: &mut Vec<(String, Ty)>,
) -> Result<TemplateCallBinding, ElabError>
pub(super) fn bind_template_call_args( &mut self, callee_name: &str, template: &RuntimeFunctionTemplate, args: &mut Vec<CallArg>, locals: &mut Vec<(String, Ty)>, ) -> Result<TemplateCallBinding, ElabError>
Bind one runtime template call argument list to specialization inputs.
Source§impl Elaborator
impl Elaborator
Sourcepub(super) fn elaborate_call_expr(
&mut self,
callee: &mut Box<Expr>,
args: &mut Vec<CallArg>,
expected: Option<&Ty>,
locals: &mut Vec<(String, Ty)>,
) -> Result<Ty, ElabError>
pub(super) fn elaborate_call_expr( &mut self, callee: &mut Box<Expr>, args: &mut Vec<CallArg>, expected: Option<&Ty>, locals: &mut Vec<(String, Ty)>, ) -> Result<Ty, ElabError>
Elaborate one runtime call expression and return its resulting type.
Sourcefn elaborate_enum_constructor_call(
&mut self,
callee: &mut Box<Expr>,
callee_name: &str,
callee_span: SourceSpan,
args: &mut Vec<CallArg>,
expected: Option<&Ty>,
locals: &mut Vec<(String, Ty)>,
) -> Result<Ty, ElabError>
fn elaborate_enum_constructor_call( &mut self, callee: &mut Box<Expr>, callee_name: &str, callee_span: SourceSpan, args: &mut Vec<CallArg>, expected: Option<&Ty>, locals: &mut Vec<(String, Ty)>, ) -> Result<Ty, ElabError>
Elaborate one enum-constructor call expression and return its resulting type.
Source§impl Elaborator
impl Elaborator
Source§impl Elaborator
impl Elaborator
Source§impl Elaborator
impl Elaborator
Sourcepub(super) fn instantiate_runtime_function(
&mut self,
callee_name: &str,
template: &RuntimeFunctionTemplate,
type_bindings: &BTreeMap<String, Ty>,
meta_bindings: &BTreeMap<String, TemplateMetaBinding>,
specialization_key: &SpecializationKey,
variadic_pack_tys: &[Ty],
) -> Result<String, ElabError>
pub(super) fn instantiate_runtime_function( &mut self, callee_name: &str, template: &RuntimeFunctionTemplate, type_bindings: &BTreeMap<String, Ty>, meta_bindings: &BTreeMap<String, TemplateMetaBinding>, specialization_key: &SpecializationKey, variadic_pack_tys: &[Ty], ) -> Result<String, ElabError>
Instantiate a runtime template function with resolved specialization bindings.
Source§impl Elaborator
impl Elaborator
Source§impl Elaborator
impl Elaborator
Source§impl Elaborator
impl Elaborator
Sourcepub(super) fn pass_timings(&self) -> &[PassTiming]
pub(super) fn pass_timings(&self) -> &[PassTiming]
Return recorded elaboration subpass timings.
Sourcepub(super) fn record_subpass_timings(&mut self, timings: &[PassTiming])
pub(super) fn record_subpass_timings(&mut self, timings: &[PassTiming])
Append one batch of elaboration subpass timings.
Sourcepub(super) fn run_subpass<P>(
pass: &mut P,
input: P::In,
) -> Result<(P::Out, Vec<PassTiming>), P::Error>where
P: Pass,
pub(super) fn run_subpass<P>(
pass: &mut P,
input: P::In,
) -> Result<(P::Out, Vec<PassTiming>), P::Error>where
P: Pass,
Run one elaboration subpass and return output with collected timing samples.
Source§impl Elaborator
impl Elaborator
pub(super) fn elaborate_block( &mut self, block: &mut Block, expected_tail: Option<&Ty>, locals: &mut Vec<(String, Ty)>, ) -> Result<Ty, ElabError>
pub(super) fn elaborate_stmt( &mut self, stmt: &mut Stmt, expected: Option<&Ty>, locals: &mut Vec<(String, Ty)>, ) -> Result<Ty, ElabError>
pub(super) fn elaborate_expr( &mut self, expr: &mut Expr, expected: Option<&Ty>, locals: &mut Vec<(String, Ty)>, ) -> Result<Ty, ElabError>
pub(super) fn resolve_struct_field_ty( &self, base_ty: &Ty, field: &str, ) -> Result<Ty, ElabError>
pub(super) fn resolve_enum_variant_payload_tys( &self, enum_name: &str, enum_args: &[Ty], variant: &str, ) -> Result<Vec<Ty>, ElabError>
pub(super) fn resolve_type_expr( &self, ty: &TypeExpr, type_bindings: &BTreeMap<String, Ty>, type_params: &BTreeSet<String>, self_ty: Option<&Ty>, ) -> Result<Ty, ElabError>
Source§impl Elaborator
impl Elaborator
Source§impl Elaborator
impl Elaborator
pub(super) fn elaborate_function_body( &mut self, function: &mut FunctionDecl, ) -> Result<(), ElabError>
pub(super) fn bind_meta_arg( &self, callee_name: &str, param: &Param, expr: &Expr, ) -> Result<TemplateMetaBinding, ElabError>
pub(super) fn next_instance_name(&mut self, callee_name: &str) -> String
pub(super) fn elaborate_call_runtime_args( &mut self, args: &mut Vec<CallArg>, params: &[(OwnershipMode, Ty)], locals: &mut Vec<(String, Ty)>, callee_name: &str, ) -> Result<(), ElabError>
pub(super) fn resolve_function_signature( &mut self, function: &FunctionDecl, type_params: &[String], bindings: &BTreeMap<String, Ty>, ) -> Result<FunctionSig, ElabError>
pub(super) fn apply_type_bindings_to_function( &mut self, function: &mut FunctionDecl, bindings: &BTreeMap<String, Ty>, type_params: &[String], ) -> Result<(), ElabError>
pub(super) fn specialize_function_params( &mut self, function: &mut FunctionDecl, variadic_pack_tys: &[Ty], ) -> Result<(), ElabError>
pub(super) fn apply_variadic_param_substitutions( &mut self, function: &mut FunctionDecl, original_params: &[Param], variadic_pack_tys: &[Ty], ) -> Result<(), ElabError>
pub(super) fn apply_meta_bindings_to_function( &mut self, function: &mut FunctionDecl, bindings: &BTreeMap<String, TemplateMetaBinding>, ) -> Result<(), ElabError>
pub(super) fn apply_expr_replacements_to_block( &mut self, block: &mut Block, replacements: &BTreeMap<String, Expr>, ) -> Result<(), ElabError>
pub(super) fn apply_expr_replacements_to_stmt( &mut self, stmt: &mut Stmt, replacements: &BTreeMap<String, Expr>, ) -> Result<(), ElabError>
pub(super) fn apply_expr_replacements_to_meta_block( &mut self, block: &mut MetaBlock, replacements: &BTreeMap<String, Expr>, ) -> Result<(), ElabError>
pub(super) fn apply_expr_replacements_to_meta_expr( &mut self, expr: &mut MetaExpr, replacements: &BTreeMap<String, Expr>, ) -> Result<(), ElabError>
pub(super) fn apply_expr_replacements_to_quoted_code( &mut self, quoted: &mut QuotedCode, replacements: &BTreeMap<String, Expr>, ) -> Result<(), ElabError>
pub(super) fn apply_expr_replacements_to_expr( &mut self, expr: &mut Expr, replacements: &BTreeMap<String, Expr>, ) -> Result<(), ElabError>
pub(super) fn apply_meta_bindings_to_block( &mut self, block: &mut Block, bindings: &BTreeMap<String, TemplateMetaBinding>, ) -> Result<(), ElabError>
pub(super) fn apply_meta_bindings_to_stmt( &mut self, stmt: &mut Stmt, bindings: &BTreeMap<String, TemplateMetaBinding>, ) -> Result<(), ElabError>
pub(super) fn apply_meta_bindings_to_expr( &mut self, expr: &mut Expr, bindings: &BTreeMap<String, TemplateMetaBinding>, ) -> Result<(), ElabError>
pub(super) fn apply_type_bindings_to_block( &mut self, block: &mut Block, bindings: &BTreeMap<String, Ty>, type_params: &BTreeSet<String>, ) -> Result<(), ElabError>
pub(super) fn apply_type_bindings_to_stmt( &mut self, stmt: &mut Stmt, bindings: &BTreeMap<String, Ty>, type_params: &BTreeSet<String>, ) -> Result<(), ElabError>
pub(super) fn apply_type_bindings_to_expr( &mut self, expr: &mut Expr, bindings: &BTreeMap<String, Ty>, type_params: &BTreeSet<String>, ) -> Result<(), ElabError>
pub(super) fn apply_type_bindings_to_call_arg( &mut self, arg: &mut CallArg, bindings: &BTreeMap<String, Ty>, type_params: &BTreeSet<String>, ) -> Result<(), ElabError>
pub(super) fn apply_type_bindings_to_type_ref( &mut self, ty: &mut TypeRef, bindings: &BTreeMap<String, Ty>, type_params: &BTreeSet<String>, ) -> Result<(), ElabError>
Auto Trait Implementations§
impl Freeze for Elaborator
impl RefUnwindSafe for Elaborator
impl Send for Elaborator
impl Sync for Elaborator
impl Unpin for Elaborator
impl UnwindSafe for Elaborator
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