apply clippy changes
This commit is contained in:
parent
d89146aa02
commit
06e9d90d57
@ -65,7 +65,7 @@ pub struct ArtiqCodeGenerator<'a> {
|
|||||||
end: Option<Expr<Option<Type>>>,
|
end: Option<Expr<Option<Type>>>,
|
||||||
timeline: &'a (dyn TimeFns + Sync),
|
timeline: &'a (dyn TimeFns + Sync),
|
||||||
|
|
||||||
/// The [ParallelMode] of the current parallel context.
|
/// The [`ParallelMode`] of the current parallel context.
|
||||||
///
|
///
|
||||||
/// The current parallel context refers to the nearest `with parallel` or `with legacy_parallel`
|
/// The current parallel context refers to the nearest `with parallel` or `with legacy_parallel`
|
||||||
/// statement, which is used to determine when and how the timeline should be updated.
|
/// statement, which is used to determine when and how the timeline should be updated.
|
||||||
|
@ -764,7 +764,7 @@ pub fn gen_call<'ctx, G: CodeGenerator>(
|
|||||||
}
|
}
|
||||||
// default value handling
|
// default value handling
|
||||||
for k in keys {
|
for k in keys {
|
||||||
if mapping.get(&k.name).is_some() {
|
if mapping.contains_key(&k.name) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mapping.insert(
|
mapping.insert(
|
||||||
|
@ -135,24 +135,23 @@ pub struct CodeGenContext<'ctx, 'a> {
|
|||||||
|
|
||||||
/// The [Builder] instance for creating LLVM IR statements.
|
/// The [Builder] instance for creating LLVM IR statements.
|
||||||
pub builder: Builder<'ctx>,
|
pub builder: Builder<'ctx>,
|
||||||
/// The [DebugInfoBuilder], [compilation unit information][DICompileUnit], and
|
/// The [`DebugInfoBuilder`], [compilation unit information][DICompileUnit], and
|
||||||
/// [scope information][DIScope] of this context.
|
/// [scope information][DIScope] of this context.
|
||||||
pub debug_info: (DebugInfoBuilder<'ctx>, DICompileUnit<'ctx>, DIScope<'ctx>),
|
pub debug_info: (DebugInfoBuilder<'ctx>, DICompileUnit<'ctx>, DIScope<'ctx>),
|
||||||
|
|
||||||
/// The module for which [this context][CodeGenContext] is generating into.
|
/// The module for which [this context][CodeGenContext] is generating into.
|
||||||
pub module: Module<'ctx>,
|
pub module: Module<'ctx>,
|
||||||
|
|
||||||
/// The [TopLevelContext] associated with [this context][CodeGenContext].
|
/// The [`TopLevelContext`] associated with [this context][CodeGenContext].
|
||||||
pub top_level: &'a TopLevelContext,
|
pub top_level: &'a TopLevelContext,
|
||||||
pub unifier: Unifier,
|
pub unifier: Unifier,
|
||||||
pub resolver: Arc<dyn SymbolResolver + Send + Sync>,
|
pub resolver: Arc<dyn SymbolResolver + Send + Sync>,
|
||||||
pub static_value_store: Arc<Mutex<StaticValueStore>>,
|
pub static_value_store: Arc<Mutex<StaticValueStore>>,
|
||||||
|
|
||||||
/// A [HashMap] containing the mapping between the names of variables currently in-scope and
|
/// A [`HashMap`] containing the mapping between the names of variables currently in-scope and
|
||||||
/// its value information.
|
/// its value information.
|
||||||
pub var_assignment: HashMap<StrRef, VarValue<'ctx>>,
|
pub var_assignment: HashMap<StrRef, VarValue<'ctx>>,
|
||||||
|
|
||||||
///
|
|
||||||
pub type_cache: HashMap<Type, BasicTypeEnum<'ctx>>,
|
pub type_cache: HashMap<Type, BasicTypeEnum<'ctx>>,
|
||||||
pub primitives: PrimitiveStore,
|
pub primitives: PrimitiveStore,
|
||||||
pub calls: Arc<HashMap<CodeLocation, CallId>>,
|
pub calls: Arc<HashMap<CodeLocation, CallId>>,
|
||||||
@ -161,24 +160,24 @@ pub struct CodeGenContext<'ctx, 'a> {
|
|||||||
/// Cache for constant strings.
|
/// Cache for constant strings.
|
||||||
pub const_strings: HashMap<String, BasicValueEnum<'ctx>>,
|
pub const_strings: HashMap<String, BasicValueEnum<'ctx>>,
|
||||||
|
|
||||||
/// [BasicBlock] containing all `alloca` statements for the current function.
|
/// [`BasicBlock`] containing all `alloca` statements for the current function.
|
||||||
pub init_bb: BasicBlock<'ctx>,
|
pub init_bb: BasicBlock<'ctx>,
|
||||||
pub exception_val: Option<PointerValue<'ctx>>,
|
pub exception_val: Option<PointerValue<'ctx>>,
|
||||||
|
|
||||||
/// The header and exit basic blocks of a loop in this context. See
|
/// The header and exit basic blocks of a loop in this context. See
|
||||||
/// https://llvm.org/docs/LoopTerminology.html for explanation of these terminology.
|
/// <https://llvm.org/docs/LoopTerminology.html> for explanation of these terminology.
|
||||||
pub loop_target: Option<(BasicBlock<'ctx>, BasicBlock<'ctx>)>,
|
pub loop_target: Option<(BasicBlock<'ctx>, BasicBlock<'ctx>)>,
|
||||||
|
|
||||||
/// The target [BasicBlock] to jump to when performing stack unwind.
|
/// The target [`BasicBlock`] to jump to when performing stack unwind.
|
||||||
pub unwind_target: Option<BasicBlock<'ctx>>,
|
pub unwind_target: Option<BasicBlock<'ctx>>,
|
||||||
|
|
||||||
/// The target [BasicBlock] to jump to before returning from the function.
|
/// The target [`BasicBlock`] to jump to before returning from the function.
|
||||||
///
|
///
|
||||||
/// If this field is [None] when generating a return from a function, `ret` with no argument can
|
/// If this field is [None] when generating a return from a function, `ret` with no argument can
|
||||||
/// be emitted.
|
/// be emitted.
|
||||||
pub return_target: Option<BasicBlock<'ctx>>,
|
pub return_target: Option<BasicBlock<'ctx>>,
|
||||||
|
|
||||||
/// The [PointerValue] containing the return value of the function.
|
/// The [`PointerValue`] containing the return value of the function.
|
||||||
pub return_buffer: Option<PointerValue<'ctx>>,
|
pub return_buffer: Option<PointerValue<'ctx>>,
|
||||||
|
|
||||||
// outer catch clauses
|
// outer catch clauses
|
||||||
@ -187,7 +186,7 @@ pub struct CodeGenContext<'ctx, 'a> {
|
|||||||
|
|
||||||
/// Whether `sret` is needed for the first parameter of the function.
|
/// Whether `sret` is needed for the first parameter of the function.
|
||||||
///
|
///
|
||||||
/// See [need_sret].
|
/// See [`need_sret`].
|
||||||
pub need_sret: bool,
|
pub need_sret: bool,
|
||||||
|
|
||||||
/// The current source location.
|
/// The current source location.
|
||||||
|
@ -296,10 +296,10 @@ pub trait StaticValue {
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub enum ValueEnum<'ctx> {
|
pub enum ValueEnum<'ctx> {
|
||||||
/// [ValueEnum] representing a static value.
|
/// [`ValueEnum`] representing a static value.
|
||||||
Static(Arc<dyn StaticValue + Send + Sync>),
|
Static(Arc<dyn StaticValue + Send + Sync>),
|
||||||
|
|
||||||
/// [ValueEnum] representing a dynamic value.
|
/// [`ValueEnum`] representing a dynamic value.
|
||||||
Dynamic(BasicValueEnum<'ctx>),
|
Dynamic(BasicValueEnum<'ctx>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ pub enum TopLevelDef {
|
|||||||
Class {
|
Class {
|
||||||
/// Name for error messages and symbols.
|
/// Name for error messages and symbols.
|
||||||
name: StrRef,
|
name: StrRef,
|
||||||
/// Object ID used for [TypeEnum].
|
/// Object ID used for [`TypeEnum`].
|
||||||
object_id: DefinitionId,
|
object_id: DefinitionId,
|
||||||
/// type variables bounded to the class.
|
/// type variables bounded to the class.
|
||||||
type_vars: Vec<Type>,
|
type_vars: Vec<Type>,
|
||||||
|
@ -549,7 +549,7 @@ fn test_basic(source: &str, mapping: &HashMap<&str, &str>, virtuals: &[(&str, &s
|
|||||||
let mut defined_identifiers: HashSet<_> = env.identifier_mapping.keys().copied().collect();
|
let mut defined_identifiers: HashSet<_> = env.identifier_mapping.keys().copied().collect();
|
||||||
defined_identifiers.insert("virtual".into());
|
defined_identifiers.insert("virtual".into());
|
||||||
let mut inferencer = env.get_inferencer();
|
let mut inferencer = env.get_inferencer();
|
||||||
inferencer.defined_identifiers = defined_identifiers.clone();
|
inferencer.defined_identifiers.clone_from(&defined_identifiers);
|
||||||
let statements = parse_program(source, FileName::default()).unwrap();
|
let statements = parse_program(source, FileName::default()).unwrap();
|
||||||
let statements = statements
|
let statements = statements
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@ -695,7 +695,7 @@ fn test_primitive_magic_methods(source: &str, mapping: &HashMap<&str, &str>) {
|
|||||||
let mut defined_identifiers: HashSet<_> = env.identifier_mapping.keys().copied().collect();
|
let mut defined_identifiers: HashSet<_> = env.identifier_mapping.keys().copied().collect();
|
||||||
defined_identifiers.insert("virtual".into());
|
defined_identifiers.insert("virtual".into());
|
||||||
let mut inferencer = env.get_inferencer();
|
let mut inferencer = env.get_inferencer();
|
||||||
inferencer.defined_identifiers = defined_identifiers.clone();
|
inferencer.defined_identifiers.clone_from(&defined_identifiers);
|
||||||
let statements = parse_program(source, FileName::default()).unwrap();
|
let statements = parse_program(source, FileName::default()).unwrap();
|
||||||
let statements = statements
|
let statements = statements
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -208,7 +208,7 @@ pub enum TypeEnum {
|
|||||||
|
|
||||||
/// An object type.
|
/// An object type.
|
||||||
TObj {
|
TObj {
|
||||||
/// The [DefintionId] of this object type.
|
/// The [`DefinitionId`] of this object type.
|
||||||
obj_id: DefinitionId,
|
obj_id: DefinitionId,
|
||||||
|
|
||||||
/// The fields present in this object type.
|
/// The fields present in this object type.
|
||||||
|
Loading…
Reference in New Issue
Block a user