mirror of
https://github.com/roc-lang/roc.git
synced 2024-10-04 22:27:55 +03:00
apply Ayaz review suggestions
This commit is contained in:
parent
c1d0c24194
commit
ec874655dd
@ -1,9 +1,4 @@
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
hash::{BuildHasher, Hasher},
|
||||
marker::PhantomData,
|
||||
sync::Arc,
|
||||
};
|
||||
use std::{cell::RefCell, hash::BuildHasher, marker::PhantomData, sync::Arc};
|
||||
|
||||
use bumpalo::Bump;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
@ -591,12 +586,8 @@ struct LockedGlobalInterner<'a, 'r> {
|
||||
///
|
||||
/// This uses the [default_hasher], so interner maps should also rely on [default_hasher].
|
||||
fn hash<V: std::hash::Hash>(val: V) -> u64 {
|
||||
let mut state = roc_collections::all::BuildHasher::default().build_hasher();
|
||||
val.hash(&mut state);
|
||||
|
||||
// clippy suggests a stylistic improvement but the suggested fix doesn't seem to work out
|
||||
#[allow(clippy::manual_hash_one)]
|
||||
state.finish()
|
||||
let hasher = roc_collections::all::BuildHasher::default();
|
||||
hasher.hash_one(&val)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
@ -264,22 +264,22 @@ fn crash_kw<'a>() -> impl Parser<'a, Expr<'a>, EExpr<'a>> {
|
||||
}
|
||||
}
|
||||
|
||||
// avoids ownership issues
|
||||
#[allow(clippy::blocks_in_conditions)]
|
||||
fn loc_possibly_negative_or_negated_term<'a>(
|
||||
options: ExprParseOptions,
|
||||
) -> impl Parser<'a, Loc<Expr<'a>>, EExpr<'a>> {
|
||||
let parse_unary_negate = move |arena, state: State<'a>, min_indent: u32| {
|
||||
let initial = state.clone();
|
||||
|
||||
let (_, (loc_op, loc_expr), state) =
|
||||
and!(loc!(unary_negate()), loc_term(options)).parse(arena, state, min_indent)?;
|
||||
|
||||
let loc_expr = numeric_negate_expression(arena, initial, loc_op, loc_expr, &[]);
|
||||
|
||||
Ok((MadeProgress, loc_expr, state))
|
||||
};
|
||||
|
||||
one_of![
|
||||
|arena, state: State<'a>, min_indent: u32| {
|
||||
let initial = state.clone();
|
||||
|
||||
let (_, (loc_op, loc_expr), state) =
|
||||
and!(loc!(unary_negate()), loc_term(options)).parse(arena, state, min_indent)?;
|
||||
|
||||
let loc_expr = numeric_negate_expression(arena, initial, loc_op, loc_expr, &[]);
|
||||
|
||||
Ok((MadeProgress, loc_expr, state))
|
||||
},
|
||||
parse_unary_negate,
|
||||
// this will parse negative numbers, which the unary negate thing up top doesn't (for now)
|
||||
loc!(specialize_err(EExpr::Number, number_literal_help())),
|
||||
loc!(map_with_arena!(
|
||||
|
@ -335,7 +335,8 @@ pub fn helper<'a>(
|
||||
let (main_fn_name, delayed_errors, module) =
|
||||
create_llvm_module(arena, src, config, context, target, function_kind);
|
||||
|
||||
//module.print_to_file(std::path::Path::new("/home/username/gitrepos/roc4/roc/str_to_u128.ll")).unwrap();
|
||||
// for debugging:
|
||||
//module.print_to_file(std::path::Path::new("/home/username/roc/llvm_ir.ll")).unwrap();
|
||||
|
||||
if !config.emit_debug_info {
|
||||
module.strip_debug_info();
|
||||
|
Loading…
Reference in New Issue
Block a user