mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
store filenames out of band
This commit is contained in:
parent
da89152fef
commit
3d30bcef03
1 changed files with 7 additions and 5 deletions
|
@ -18,6 +18,7 @@ pub struct Constraints {
|
||||||
pub expectations: Vec<Expected<Type>>,
|
pub expectations: Vec<Expected<Type>>,
|
||||||
pub pattern_expectations: Vec<PExpected<Type>>,
|
pub pattern_expectations: Vec<PExpected<Type>>,
|
||||||
pub includes_tags: Vec<IncludesTag>,
|
pub includes_tags: Vec<IncludesTag>,
|
||||||
|
pub strings: Vec<&'static str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Constraints {
|
impl Default for Constraints {
|
||||||
|
@ -38,6 +39,7 @@ impl Constraints {
|
||||||
let expectations = Vec::new();
|
let expectations = Vec::new();
|
||||||
let pattern_expectations = Vec::new();
|
let pattern_expectations = Vec::new();
|
||||||
let includes_tags = Vec::new();
|
let includes_tags = Vec::new();
|
||||||
|
let strings = Vec::new();
|
||||||
|
|
||||||
types.extend([Type::EmptyRec, Type::EmptyTagUnion]);
|
types.extend([Type::EmptyRec, Type::EmptyTagUnion]);
|
||||||
|
|
||||||
|
@ -83,6 +85,7 @@ impl Constraints {
|
||||||
expectations,
|
expectations,
|
||||||
pattern_expectations,
|
pattern_expectations,
|
||||||
includes_tags,
|
includes_tags,
|
||||||
|
strings,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,11 +430,10 @@ impl Constraints {
|
||||||
filename: &'static str,
|
filename: &'static str,
|
||||||
line_number: u32,
|
line_number: u32,
|
||||||
) -> Constraint {
|
) -> Constraint {
|
||||||
let type_index = Index::new(self.types.len() as _);
|
let type_index = Index::push_new(&mut self.types, typ);
|
||||||
|
let string_index = Index::push_new(&mut self.strings, filename);
|
||||||
|
|
||||||
self.types.push(typ);
|
Constraint::Store(type_index, variable, string_index, line_number)
|
||||||
|
|
||||||
Constraint::Store(type_index, variable, filename, line_number)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +442,7 @@ static_assertions::assert_eq_size!([u8; 3 * 8], Constraint);
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Constraint {
|
pub enum Constraint {
|
||||||
Eq(Index<Type>, Index<Expected<Type>>, Index<Category>, Region),
|
Eq(Index<Type>, Index<Expected<Type>>, Index<Category>, Region),
|
||||||
Store(Index<Type>, Variable, &'static str, u32),
|
Store(Index<Type>, Variable, Index<&'static str>, u32),
|
||||||
Lookup(Symbol, Index<Expected<Type>>, Region),
|
Lookup(Symbol, Index<Expected<Type>>, Region),
|
||||||
Pattern(
|
Pattern(
|
||||||
Index<Type>,
|
Index<Type>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue