mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
cleanup
This commit is contained in:
parent
7b8716b1d7
commit
11ea52731c
1 changed files with 5 additions and 4 deletions
|
@ -11,6 +11,7 @@ use roc_module::symbol::Symbol;
|
||||||
/// COMPILE CASES
|
/// COMPILE CASES
|
||||||
|
|
||||||
type Label = u64;
|
type Label = u64;
|
||||||
|
const RECORD_TAG_NAME: &'static str = "#Record";
|
||||||
|
|
||||||
/// Users of this module will mainly interact with this function. It takes
|
/// Users of this module will mainly interact with this function. It takes
|
||||||
/// some normal branches and gives out a decision tree that has "labels" at all
|
/// some normal branches and gives out a decision tree that has "labels" at all
|
||||||
|
@ -189,7 +190,7 @@ fn to_decision_tree(raw_branches: Vec<Branch>) -> DecisionTree {
|
||||||
fn is_complete(tests: &[Test]) -> bool {
|
fn is_complete(tests: &[Test]) -> bool {
|
||||||
let length = tests.len();
|
let length = tests.len();
|
||||||
debug_assert!(length > 0);
|
debug_assert!(length > 0);
|
||||||
match tests.get(length - 1) {
|
match tests.last() {
|
||||||
None => unreachable!("should never happen"),
|
None => unreachable!("should never happen"),
|
||||||
Some(v) => match v {
|
Some(v) => match v {
|
||||||
Test::IsCtor { union, .. } => length == union.alternatives.len(),
|
Test::IsCtor { union, .. } => length == union.alternatives.len(),
|
||||||
|
@ -395,7 +396,7 @@ fn test_at_path<'a>(selected_path: &Path, branch: &Branch<'a>, all_tests: &mut V
|
||||||
render_as: RenderAs::Tag,
|
render_as: RenderAs::Tag,
|
||||||
alternatives: vec![Ctor {
|
alternatives: vec![Ctor {
|
||||||
tag_id: TagId(0),
|
tag_id: TagId(0),
|
||||||
name: TagName::Global("#Record".into()),
|
name: TagName::Global(RECORD_TAG_NAME.into()),
|
||||||
arity: destructs.len(),
|
arity: destructs.len(),
|
||||||
}],
|
}],
|
||||||
};
|
};
|
||||||
|
@ -418,7 +419,7 @@ fn test_at_path<'a>(selected_path: &Path, branch: &Branch<'a>, all_tests: &mut V
|
||||||
|
|
||||||
all_tests.push(IsCtor {
|
all_tests.push(IsCtor {
|
||||||
tag_id: 0,
|
tag_id: 0,
|
||||||
tag_name: TagName::Global("#Record".into()),
|
tag_name: TagName::Global(RECORD_TAG_NAME.into()),
|
||||||
union,
|
union,
|
||||||
arguments,
|
arguments,
|
||||||
});
|
});
|
||||||
|
@ -538,7 +539,7 @@ fn to_relevant_branch_help<'a>(
|
||||||
tag_id,
|
tag_id,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
debug_assert!(test_name == &TagName::Global("#Record".into()));
|
debug_assert!(test_name == &TagName::Global(RECORD_TAG_NAME.into()));
|
||||||
let sub_positions = destructs.into_iter().enumerate().map(|(index, destruct)| {
|
let sub_positions = destructs.into_iter().enumerate().map(|(index, destruct)| {
|
||||||
let pattern = match destruct.typ {
|
let pattern = match destruct.typ {
|
||||||
DestructType::Guard(guard) => guard.clone(),
|
DestructType::Guard(guard) => guard.clone(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue