mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
clippy + fmt
This commit is contained in:
parent
fb7fa99b2c
commit
05a61e2210
11 changed files with 55 additions and 65 deletions
|
@ -351,6 +351,7 @@ struct ValgrindOutput {
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
|
#[allow(dead_code)] // Some fields are unused but this allows for easy deserialization of the xml.
|
||||||
enum ValgrindField {
|
enum ValgrindField {
|
||||||
ProtocolVersion(isize),
|
ProtocolVersion(isize),
|
||||||
ProtocolTool(String),
|
ProtocolTool(String),
|
||||||
|
|
|
@ -22,7 +22,6 @@ use std::ffi::OsStr;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::{
|
use std::{
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
thread::JoinHandle,
|
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -915,11 +914,6 @@ fn build_loaded_file<'a>(
|
||||||
let problems = report_problems_monomorphized(&mut loaded);
|
let problems = report_problems_monomorphized(&mut loaded);
|
||||||
let loaded = loaded;
|
let loaded = loaded;
|
||||||
|
|
||||||
enum HostRebuildTiming {
|
|
||||||
BeforeApp(u128),
|
|
||||||
ConcurrentWithApp(JoinHandle<u128>),
|
|
||||||
}
|
|
||||||
|
|
||||||
let opt_rebuild_timing = if let Some(rebuild_thread) = rebuild_thread {
|
let opt_rebuild_timing = if let Some(rebuild_thread) = rebuild_thread {
|
||||||
if linking_strategy == LinkingStrategy::Additive {
|
if linking_strategy == LinkingStrategy::Additive {
|
||||||
let rebuild_duration = rebuild_thread
|
let rebuild_duration = rebuild_thread
|
||||||
|
@ -930,9 +924,9 @@ fn build_loaded_file<'a>(
|
||||||
println!("Finished rebuilding the platform in {rebuild_duration} ms\n");
|
println!("Finished rebuilding the platform in {rebuild_duration} ms\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(HostRebuildTiming::BeforeApp(rebuild_duration))
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(HostRebuildTiming::ConcurrentWithApp(rebuild_thread))
|
Some(rebuild_thread)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -977,7 +971,7 @@ fn build_loaded_file<'a>(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(HostRebuildTiming::ConcurrentWithApp(thread)) = opt_rebuild_timing {
|
if let Some(thread) = opt_rebuild_timing {
|
||||||
let rebuild_duration = thread.join().expect("Failed to (re)build platform.");
|
let rebuild_duration = thread.join().expect("Failed to (re)build platform.");
|
||||||
|
|
||||||
if emit_timings && !is_platform_prebuilt {
|
if emit_timings && !is_platform_prebuilt {
|
||||||
|
|
|
@ -150,11 +150,7 @@ impl ExpectsOrDbgs {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
enum PendingValueDef<'a> {
|
enum PendingValueDef<'a> {
|
||||||
/// A standalone annotation with no body
|
/// A standalone annotation with no body
|
||||||
AnnotationOnly(
|
AnnotationOnly(Loc<Pattern>, &'a Loc<ast::TypeAnnotation<'a>>),
|
||||||
&'a Loc<ast::Pattern<'a>>,
|
|
||||||
Loc<Pattern>,
|
|
||||||
&'a Loc<ast::TypeAnnotation<'a>>,
|
|
||||||
),
|
|
||||||
/// A body with no type annotation
|
/// A body with no type annotation
|
||||||
Body(Loc<Pattern>, &'a Loc<ast::Expr<'a>>),
|
Body(Loc<Pattern>, &'a Loc<ast::Expr<'a>>),
|
||||||
/// A body with a type annotation
|
/// A body with a type annotation
|
||||||
|
@ -175,7 +171,7 @@ enum PendingValueDef<'a> {
|
||||||
impl PendingValueDef<'_> {
|
impl PendingValueDef<'_> {
|
||||||
fn loc_pattern(&self) -> &Loc<Pattern> {
|
fn loc_pattern(&self) -> &Loc<Pattern> {
|
||||||
match self {
|
match self {
|
||||||
PendingValueDef::AnnotationOnly(_, loc_pattern, _) => loc_pattern,
|
PendingValueDef::AnnotationOnly(loc_pattern, _) => loc_pattern,
|
||||||
PendingValueDef::Body(loc_pattern, _) => loc_pattern,
|
PendingValueDef::Body(loc_pattern, _) => loc_pattern,
|
||||||
PendingValueDef::TypedBody(_, loc_pattern, _, _) => loc_pattern,
|
PendingValueDef::TypedBody(_, loc_pattern, _, _) => loc_pattern,
|
||||||
PendingValueDef::IngestedFile(loc_pattern, _, _) => loc_pattern,
|
PendingValueDef::IngestedFile(loc_pattern, _, _) => loc_pattern,
|
||||||
|
@ -2208,7 +2204,7 @@ fn canonicalize_pending_value_def<'a>(
|
||||||
let pending_abilities_in_scope = &Default::default();
|
let pending_abilities_in_scope = &Default::default();
|
||||||
|
|
||||||
let output = match pending_def {
|
let output = match pending_def {
|
||||||
AnnotationOnly(_, loc_can_pattern, loc_ann) => {
|
AnnotationOnly(loc_can_pattern, loc_ann) => {
|
||||||
// Make types for the body expr, even if we won't end up having a body.
|
// Make types for the body expr, even if we won't end up having a body.
|
||||||
let expr_var = var_store.fresh();
|
let expr_var = var_store.fresh();
|
||||||
let mut vars_by_symbol = SendMap::default();
|
let mut vars_by_symbol = SendMap::default();
|
||||||
|
@ -2950,7 +2946,6 @@ fn to_pending_value_def<'a>(
|
||||||
);
|
);
|
||||||
|
|
||||||
PendingValue::Def(PendingValueDef::AnnotationOnly(
|
PendingValue::Def(PendingValueDef::AnnotationOnly(
|
||||||
loc_pattern,
|
|
||||||
loc_can_pattern,
|
loc_can_pattern,
|
||||||
loc_ann,
|
loc_ann,
|
||||||
))
|
))
|
||||||
|
|
|
@ -12,7 +12,7 @@ use std::cell::Cell;
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
// we use a thread_local here so that tests consistently give the same pattern
|
// we use a thread_local here so that tests consistently give the same pattern
|
||||||
static SUFFIXED_ANSWER_COUNTER: Cell<usize> = Cell::new(0);
|
static SUFFIXED_ANSWER_COUNTER: Cell<usize> = const { Cell::new(0) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Provide an intermediate answer expression and pattern when unwrapping a
|
/// Provide an intermediate answer expression and pattern when unwrapping a
|
||||||
|
|
|
@ -131,6 +131,8 @@ enum PatternBindingIter<'r, 'a> {
|
||||||
|
|
||||||
enum PatternBindingWork<'r, 'a> {
|
enum PatternBindingWork<'r, 'a> {
|
||||||
Pat(&'r Pattern<'a>),
|
Pat(&'r Pattern<'a>),
|
||||||
|
#[allow(dead_code)]
|
||||||
|
// Field will be used once todo is immplemented in next in impl<'r, 'a> Iterator for PatternBindingIter
|
||||||
RecordDestruct(&'r DestructType<'a>),
|
RecordDestruct(&'r DestructType<'a>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -960,13 +960,13 @@ fn write_integer<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ExtContent<'a> {
|
enum ExtContent {
|
||||||
Empty,
|
Empty,
|
||||||
Content(Variable, &'a Content),
|
Content(Variable),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ExtContent<'a> {
|
impl ExtContent {
|
||||||
fn for_tag(subs: &'a Subs, ext: Variable, pol: Polarity, debug_flags: &DebugPrint) -> Self {
|
fn for_tag(subs: &Subs, ext: Variable, pol: Polarity, debug_flags: &DebugPrint) -> Self {
|
||||||
let content = subs.get_content_without_compacting(ext);
|
let content = subs.get_content_without_compacting(ext);
|
||||||
match content {
|
match content {
|
||||||
Content::Structure(FlatType::EmptyTagUnion) => ExtContent::Empty,
|
Content::Structure(FlatType::EmptyTagUnion) => ExtContent::Empty,
|
||||||
|
@ -983,7 +983,7 @@ impl<'a> ExtContent<'a> {
|
||||||
Content::FlexVar(_)
|
Content::FlexVar(_)
|
||||||
| Content::FlexAbleVar(..)
|
| Content::FlexAbleVar(..)
|
||||||
| Content::RigidVar(_)
|
| Content::RigidVar(_)
|
||||||
| Content::RigidAbleVar(..) => ExtContent::Content(ext, content),
|
| Content::RigidAbleVar(..) => ExtContent::Content(ext),
|
||||||
|
|
||||||
other => unreachable!("something weird ended up in an ext var: {:?}", other),
|
other => unreachable!("something weird ended up in an ext var: {:?}", other),
|
||||||
}
|
}
|
||||||
|
@ -995,11 +995,11 @@ fn write_ext_content<'a>(
|
||||||
ctx: &mut Context<'a>,
|
ctx: &mut Context<'a>,
|
||||||
subs: &'a Subs,
|
subs: &'a Subs,
|
||||||
buf: &mut String,
|
buf: &mut String,
|
||||||
ext_content: ExtContent<'a>,
|
ext_content: ExtContent,
|
||||||
parens: Parens,
|
parens: Parens,
|
||||||
pol: Polarity,
|
pol: Polarity,
|
||||||
) {
|
) {
|
||||||
if let ExtContent::Content(var, _) = ext_content {
|
if let ExtContent::Content(var) = ext_content {
|
||||||
// This is an open record or tag union, so print the variable
|
// This is an open record or tag union, so print the variable
|
||||||
// right after the '}' or ']'
|
// right after the '}' or ']'
|
||||||
//
|
//
|
||||||
|
@ -1050,7 +1050,7 @@ fn write_sorted_tags<'a>(
|
||||||
tags: &MutMap<TagName, Vec<Variable>>,
|
tags: &MutMap<TagName, Vec<Variable>>,
|
||||||
ext_var: Variable,
|
ext_var: Variable,
|
||||||
pol: Polarity,
|
pol: Polarity,
|
||||||
) -> ExtContent<'a> {
|
) -> ExtContent {
|
||||||
// Sort the fields so they always end up in the same order.
|
// Sort the fields so they always end up in the same order.
|
||||||
let mut sorted_fields = Vec::with_capacity(tags.len());
|
let mut sorted_fields = Vec::with_capacity(tags.len());
|
||||||
|
|
||||||
|
|
|
@ -2533,7 +2533,7 @@ enum Rec {
|
||||||
None,
|
None,
|
||||||
Left(Variable),
|
Left(Variable),
|
||||||
Right(Variable),
|
Right(Variable),
|
||||||
Both(Variable, Variable),
|
Both(Variable),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if an extension type `ext1` should be permitted to grow by the `candidate_type`, if it
|
/// Checks if an extension type `ext1` should be permitted to grow by the `candidate_type`, if it
|
||||||
|
@ -2995,8 +2995,8 @@ fn find_union_rec(subs: &Subs, ctx: &Context) -> Rec {
|
||||||
subs.get_content_without_compacting(ctx.second),
|
subs.get_content_without_compacting(ctx.second),
|
||||||
) {
|
) {
|
||||||
(Structure(s1), Structure(s2)) => match (s1, s2) {
|
(Structure(s1), Structure(s2)) => match (s1, s2) {
|
||||||
(FlatType::RecursiveTagUnion(l, _, _), FlatType::RecursiveTagUnion(r, _, _)) => {
|
(FlatType::RecursiveTagUnion(l, _, _), FlatType::RecursiveTagUnion(_r, _, _)) => {
|
||||||
Rec::Both(*l, *r)
|
Rec::Both(*l)
|
||||||
}
|
}
|
||||||
(FlatType::RecursiveTagUnion(l, _, _), _) => Rec::Left(*l),
|
(FlatType::RecursiveTagUnion(l, _, _), _) => Rec::Left(*l),
|
||||||
(_, FlatType::RecursiveTagUnion(r, _, _)) => Rec::Right(*r),
|
(_, FlatType::RecursiveTagUnion(r, _, _)) => Rec::Right(*r),
|
||||||
|
@ -3160,7 +3160,7 @@ fn unify_shared_tags_merge<M: MetaCollector>(
|
||||||
|
|
||||||
let flat_type = match recursion_var {
|
let flat_type = match recursion_var {
|
||||||
Rec::None => FlatType::TagUnion(new_tags, new_ext),
|
Rec::None => FlatType::TagUnion(new_tags, new_ext),
|
||||||
Rec::Left(rec) | Rec::Right(rec) | Rec::Both(rec, _) => {
|
Rec::Left(rec) | Rec::Right(rec) | Rec::Both(rec) => {
|
||||||
debug_assert!(is_recursion_var(env, rec), "{:?}", env.dbg(rec));
|
debug_assert!(is_recursion_var(env, rec), "{:?}", env.dbg(rec));
|
||||||
FlatType::RecursiveTagUnion(rec, new_tags, new_ext)
|
FlatType::RecursiveTagUnion(rec, new_tags, new_ext)
|
||||||
}
|
}
|
||||||
|
|
|
@ -563,6 +563,7 @@ pub(crate) fn open_mmap_mut(path: &Path, length: usize) -> MmapMut {
|
||||||
.read(true)
|
.read(true)
|
||||||
.write(true)
|
.write(true)
|
||||||
.create(true)
|
.create(true)
|
||||||
|
.truncate(false)
|
||||||
.open(path)
|
.open(path)
|
||||||
.unwrap_or_else(|e| internal_error!("failed to create or open file {path:?}: {e}"));
|
.unwrap_or_else(|e| internal_error!("failed to create or open file {path:?}: {e}"));
|
||||||
out_file
|
out_file
|
||||||
|
|
|
@ -1698,7 +1698,11 @@ fn to_bad_ident_pattern_report<'b>(
|
||||||
enum BadIdentNext<'a> {
|
enum BadIdentNext<'a> {
|
||||||
LowercaseAccess(u32),
|
LowercaseAccess(u32),
|
||||||
UppercaseAccess(u32),
|
UppercaseAccess(u32),
|
||||||
|
#[allow(dead_code)]
|
||||||
|
// The field u32 will be used once todo is implemented in to_bad_ident_expr_report
|
||||||
NumberAccess(u32),
|
NumberAccess(u32),
|
||||||
|
#[allow(dead_code)]
|
||||||
|
// The field str will be used once todo is implemented in to_bad_ident_expr_report
|
||||||
Keyword(&'a str),
|
Keyword(&'a str),
|
||||||
DanglingDot,
|
DanglingDot,
|
||||||
Other(Option<char>),
|
Other(Option<char>),
|
||||||
|
|
|
@ -154,7 +154,7 @@ fn to_syntax_report<'a>(
|
||||||
|
|
||||||
#[allow(clippy::enum_variant_names)]
|
#[allow(clippy::enum_variant_names)]
|
||||||
enum Context {
|
enum Context {
|
||||||
InNode(Node, Position, Box<Context>),
|
InNode(Node, Position),
|
||||||
InDef(Position),
|
InDef(Position),
|
||||||
InDefFinalExpr(Position),
|
InDefFinalExpr(Position),
|
||||||
}
|
}
|
||||||
|
@ -185,16 +185,14 @@ fn to_expr_report<'a>(
|
||||||
use roc_parse::parser::EExpr;
|
use roc_parse::parser::EExpr;
|
||||||
let severity = Severity::RuntimeError;
|
let severity = Severity::RuntimeError;
|
||||||
match parse_problem {
|
match parse_problem {
|
||||||
EExpr::If(if_, pos) => to_if_report(alloc, lines, filename, context, if_, *pos),
|
EExpr::If(if_, pos) => to_if_report(alloc, lines, filename, if_, *pos),
|
||||||
EExpr::When(when, pos) => to_when_report(alloc, lines, filename, context, when, *pos),
|
EExpr::When(when, pos) => to_when_report(alloc, lines, filename, when, *pos),
|
||||||
EExpr::Closure(lambda, pos) => {
|
EExpr::Closure(lambda, pos) => {
|
||||||
to_lambda_report(alloc, lines, filename, context, lambda, *pos)
|
to_lambda_report(alloc, lines, filename, context, lambda, *pos)
|
||||||
}
|
}
|
||||||
EExpr::List(list, pos) => to_list_report(alloc, lines, filename, context, list, *pos),
|
EExpr::List(list, pos) => to_list_report(alloc, lines, filename, list, *pos),
|
||||||
EExpr::Str(string, pos) => to_str_report(alloc, lines, filename, context, string, *pos),
|
EExpr::Str(string, pos) => to_str_report(alloc, lines, filename, string, *pos),
|
||||||
EExpr::InParens(expr, pos) => {
|
EExpr::InParens(expr, pos) => to_expr_in_parens_report(alloc, lines, filename, expr, *pos),
|
||||||
to_expr_in_parens_report(alloc, lines, filename, context, expr, *pos)
|
|
||||||
}
|
|
||||||
EExpr::Type(tipe, pos) => to_type_report(alloc, lines, filename, tipe, *pos),
|
EExpr::Type(tipe, pos) => to_type_report(alloc, lines, filename, tipe, *pos),
|
||||||
EExpr::ElmStyleFunction(region, pos) => {
|
EExpr::ElmStyleFunction(region, pos) => {
|
||||||
let surroundings = Region::new(start, *pos);
|
let surroundings = Region::new(start, *pos);
|
||||||
|
@ -252,7 +250,7 @@ fn to_expr_report<'a>(
|
||||||
.indent(4),
|
.indent(4),
|
||||||
])],
|
])],
|
||||||
"->" => match context {
|
"->" => match context {
|
||||||
Context::InNode(Node::WhenBranch, _pos, _) => {
|
Context::InNode(Node::WhenBranch, _pos) => {
|
||||||
return to_unexpected_arrow_report(alloc, lines, filename, *pos, start);
|
return to_unexpected_arrow_report(alloc, lines, filename, *pos, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +390,7 @@ fn to_expr_report<'a>(
|
||||||
};
|
};
|
||||||
|
|
||||||
let (context_pos, a_thing) = match context {
|
let (context_pos, a_thing) = match context {
|
||||||
Context::InNode(node, pos, _) => match node {
|
Context::InNode(node, pos) => match node {
|
||||||
Node::WhenCondition | Node::WhenBranch | Node::WhenIfGuard => (
|
Node::WhenCondition | Node::WhenBranch | Node::WhenIfGuard => (
|
||||||
pos,
|
pos,
|
||||||
alloc.concat([
|
alloc.concat([
|
||||||
|
@ -603,7 +601,7 @@ fn to_expr_report<'a>(
|
||||||
alloc.region_with_subregion(lines.convert_region(surroundings), region, severity);
|
alloc.region_with_subregion(lines.convert_region(surroundings), region, severity);
|
||||||
|
|
||||||
let doc = match context {
|
let doc = match context {
|
||||||
Context::InNode(Node::Dbg, _, _) => alloc.stack([
|
Context::InNode(Node::Dbg, _) => alloc.stack([
|
||||||
alloc.reflow(
|
alloc.reflow(
|
||||||
r"I am partway through parsing a dbg statement, but I got stuck here:",
|
r"I am partway through parsing a dbg statement, but I got stuck here:",
|
||||||
),
|
),
|
||||||
|
@ -616,7 +614,7 @@ fn to_expr_report<'a>(
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
Context::InNode(Node::Expect, _, _) => alloc.stack([
|
Context::InNode(Node::Expect, _) => alloc.stack([
|
||||||
alloc.reflow(
|
alloc.reflow(
|
||||||
r"I am partway through parsing an expect statement, but I got stuck here:",
|
r"I am partway through parsing an expect statement, but I got stuck here:",
|
||||||
),
|
),
|
||||||
|
@ -964,7 +962,6 @@ fn to_str_report<'a>(
|
||||||
alloc: &'a RocDocAllocator<'a>,
|
alloc: &'a RocDocAllocator<'a>,
|
||||||
lines: &LineInfo,
|
lines: &LineInfo,
|
||||||
filename: PathBuf,
|
filename: PathBuf,
|
||||||
context: Context,
|
|
||||||
parse_problem: &roc_parse::parser::EString<'a>,
|
parse_problem: &roc_parse::parser::EString<'a>,
|
||||||
start: Position,
|
start: Position,
|
||||||
) -> Report<'a> {
|
) -> Report<'a> {
|
||||||
|
@ -977,7 +974,7 @@ fn to_str_report<'a>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
Context::InNode(Node::StringFormat, start, Box::new(context)),
|
Context::InNode(Node::StringFormat, start),
|
||||||
expr,
|
expr,
|
||||||
pos,
|
pos,
|
||||||
),
|
),
|
||||||
|
@ -1260,7 +1257,6 @@ fn to_expr_in_parens_report<'a>(
|
||||||
alloc: &'a RocDocAllocator<'a>,
|
alloc: &'a RocDocAllocator<'a>,
|
||||||
lines: &LineInfo,
|
lines: &LineInfo,
|
||||||
filename: PathBuf,
|
filename: PathBuf,
|
||||||
context: Context,
|
|
||||||
parse_problem: &roc_parse::parser::EInParens<'a>,
|
parse_problem: &roc_parse::parser::EInParens<'a>,
|
||||||
start: Position,
|
start: Position,
|
||||||
) -> Report<'a> {
|
) -> Report<'a> {
|
||||||
|
@ -1273,7 +1269,7 @@ fn to_expr_in_parens_report<'a>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
Context::InNode(Node::InsideParens, start, Box::new(context)),
|
Context::InNode(Node::InsideParens, start),
|
||||||
expr,
|
expr,
|
||||||
pos,
|
pos,
|
||||||
),
|
),
|
||||||
|
@ -1353,7 +1349,6 @@ fn to_list_report<'a>(
|
||||||
alloc: &'a RocDocAllocator<'a>,
|
alloc: &'a RocDocAllocator<'a>,
|
||||||
lines: &LineInfo,
|
lines: &LineInfo,
|
||||||
filename: PathBuf,
|
filename: PathBuf,
|
||||||
context: Context,
|
|
||||||
parse_problem: &roc_parse::parser::EList<'a>,
|
parse_problem: &roc_parse::parser::EList<'a>,
|
||||||
start: Position,
|
start: Position,
|
||||||
) -> Report<'a> {
|
) -> Report<'a> {
|
||||||
|
@ -1367,7 +1362,7 @@ fn to_list_report<'a>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
Context::InNode(Node::ListElement, start, Box::new(context)),
|
Context::InNode(Node::ListElement, start),
|
||||||
expr,
|
expr,
|
||||||
pos,
|
pos,
|
||||||
),
|
),
|
||||||
|
@ -1465,7 +1460,7 @@ fn to_dbg_or_expect_report<'a>(
|
||||||
to_expr_report(alloc, lines, filename, context, e_expr, *condition_start)
|
to_expr_report(alloc, lines, filename, context, e_expr, *condition_start)
|
||||||
}
|
}
|
||||||
roc_parse::parser::EExpect::Continuation(e_expr, continuation_start) => {
|
roc_parse::parser::EExpect::Continuation(e_expr, continuation_start) => {
|
||||||
let context = Context::InNode(node, start, Box::new(context));
|
let context = Context::InNode(node, start);
|
||||||
to_expr_report(alloc, lines, filename, context, e_expr, *continuation_start)
|
to_expr_report(alloc, lines, filename, context, e_expr, *continuation_start)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1710,7 +1705,6 @@ fn to_if_report<'a>(
|
||||||
alloc: &'a RocDocAllocator<'a>,
|
alloc: &'a RocDocAllocator<'a>,
|
||||||
lines: &LineInfo,
|
lines: &LineInfo,
|
||||||
filename: PathBuf,
|
filename: PathBuf,
|
||||||
context: Context,
|
|
||||||
parse_problem: &roc_parse::parser::EIf<'a>,
|
parse_problem: &roc_parse::parser::EIf<'a>,
|
||||||
start: Position,
|
start: Position,
|
||||||
) -> Report<'a> {
|
) -> Report<'a> {
|
||||||
|
@ -1723,7 +1717,7 @@ fn to_if_report<'a>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
Context::InNode(Node::IfCondition, start, Box::new(context)),
|
Context::InNode(Node::IfCondition, start),
|
||||||
expr,
|
expr,
|
||||||
pos,
|
pos,
|
||||||
),
|
),
|
||||||
|
@ -1732,7 +1726,7 @@ fn to_if_report<'a>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
Context::InNode(Node::IfThenBranch, start, Box::new(context)),
|
Context::InNode(Node::IfThenBranch, start),
|
||||||
expr,
|
expr,
|
||||||
pos,
|
pos,
|
||||||
),
|
),
|
||||||
|
@ -1741,7 +1735,7 @@ fn to_if_report<'a>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
Context::InNode(Node::IfElseBranch, start, Box::new(context)),
|
Context::InNode(Node::IfElseBranch, start),
|
||||||
expr,
|
expr,
|
||||||
pos,
|
pos,
|
||||||
),
|
),
|
||||||
|
@ -1824,7 +1818,6 @@ fn to_when_report<'a>(
|
||||||
alloc: &'a RocDocAllocator<'a>,
|
alloc: &'a RocDocAllocator<'a>,
|
||||||
lines: &LineInfo,
|
lines: &LineInfo,
|
||||||
filename: PathBuf,
|
filename: PathBuf,
|
||||||
context: Context,
|
|
||||||
parse_problem: &roc_parse::parser::EWhen<'a>,
|
parse_problem: &roc_parse::parser::EWhen<'a>,
|
||||||
start: Position,
|
start: Position,
|
||||||
) -> Report<'a> {
|
) -> Report<'a> {
|
||||||
|
@ -1861,7 +1854,7 @@ fn to_when_report<'a>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
Context::InNode(Node::WhenIfGuard, start, Box::new(context)),
|
Context::InNode(Node::WhenIfGuard, start),
|
||||||
nested,
|
nested,
|
||||||
pos,
|
pos,
|
||||||
),
|
),
|
||||||
|
@ -1896,7 +1889,7 @@ fn to_when_report<'a>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
Context::InNode(Node::WhenBranch, start, Box::new(context)),
|
Context::InNode(Node::WhenBranch, start),
|
||||||
expr,
|
expr,
|
||||||
pos,
|
pos,
|
||||||
),
|
),
|
||||||
|
@ -1905,7 +1898,7 @@ fn to_when_report<'a>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
Context::InNode(Node::WhenCondition, start, Box::new(context)),
|
Context::InNode(Node::WhenCondition, start),
|
||||||
expr,
|
expr,
|
||||||
pos,
|
pos,
|
||||||
),
|
),
|
||||||
|
@ -2340,11 +2333,7 @@ fn to_precord_report<'a>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
Context::InNode(
|
Context::InNode(Node::RecordConditionalDefault, start),
|
||||||
Node::RecordConditionalDefault,
|
|
||||||
start,
|
|
||||||
Box::new(Context::InDef(pos)),
|
|
||||||
),
|
|
||||||
expr,
|
expr,
|
||||||
pos,
|
pos,
|
||||||
),
|
),
|
||||||
|
@ -4491,6 +4480,8 @@ fn to_unfinished_ability_report<'a>(
|
||||||
enum Next<'a> {
|
enum Next<'a> {
|
||||||
Keyword(&'a str),
|
Keyword(&'a str),
|
||||||
// Operator(&'a str),
|
// Operator(&'a str),
|
||||||
|
// TODO ask Folkert for unused fields str and char
|
||||||
|
#[allow(dead_code)]
|
||||||
Close(&'a str, char),
|
Close(&'a str, char),
|
||||||
Token(&'a str),
|
Token(&'a str),
|
||||||
Other(Option<char>),
|
Other(Option<char>),
|
||||||
|
|
|
@ -20,9 +20,11 @@ pub enum Action {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
enum BlockType {
|
enum BlockType {
|
||||||
Loop(usize), // Loop block, with start address to loop back to
|
Loop(usize), // Loop block, with start address to loop back to
|
||||||
Normal, // Block created by `block` instruction
|
Normal, // Block created by `block` instruction
|
||||||
Locals(usize), // Special "block" for locals. Holds function index for debug
|
#[allow(dead_code)]
|
||||||
|
Locals(usize), // Special "block" for locals. Holds function index for debug
|
||||||
|
#[allow(dead_code)]
|
||||||
FunctionBody(usize), // Special block surrounding the function body. Holds function index for debug
|
FunctionBody(usize), // Special block surrounding the function body. Holds function index for debug
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue