mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
Rename Located -> Loc
This commit is contained in:
parent
c66c845cd2
commit
f19220473a
55 changed files with 680 additions and 683 deletions
|
@ -7,7 +7,7 @@ use roc_module::symbol::Symbol;
|
|||
use roc_parse::ast::{self, StrLiteral, StrSegment};
|
||||
use roc_parse::pattern::PatternType;
|
||||
use roc_problem::can::{MalformedPatternProblem, Problem, RuntimeError};
|
||||
use roc_region::all::{Located, Region};
|
||||
use roc_region::all::{Loc, Region};
|
||||
use roc_types::subs::{VarStore, Variable};
|
||||
/// A pattern, including possible problems (e.g. shadowing) so that
|
||||
/// codegen can generate a runtime error if this pattern is reached.
|
||||
|
@ -18,12 +18,12 @@ pub enum Pattern {
|
|||
whole_var: Variable,
|
||||
ext_var: Variable,
|
||||
tag_name: TagName,
|
||||
arguments: Vec<(Variable, Located<Pattern>)>,
|
||||
arguments: Vec<(Variable, Loc<Pattern>)>,
|
||||
},
|
||||
RecordDestructure {
|
||||
whole_var: Variable,
|
||||
ext_var: Variable,
|
||||
destructs: Vec<Located<RecordDestruct>>,
|
||||
destructs: Vec<Loc<RecordDestruct>>,
|
||||
},
|
||||
IntLiteral(Variable, Box<str>, i64),
|
||||
NumLiteral(Variable, Box<str>, i64),
|
||||
|
@ -32,7 +32,7 @@ pub enum Pattern {
|
|||
Underscore,
|
||||
|
||||
// Runtime Exceptions
|
||||
Shadowed(Region, Located<Ident>),
|
||||
Shadowed(Region, Loc<Ident>),
|
||||
// Example: (5 = 1 + 2) is an unsupported pattern in an assignment; Int patterns aren't allowed in assignments!
|
||||
UnsupportedPattern(Region),
|
||||
// parse error patterns
|
||||
|
@ -50,8 +50,8 @@ pub struct RecordDestruct {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum DestructType {
|
||||
Required,
|
||||
Optional(Variable, Located<Expr>),
|
||||
Guard(Variable, Located<Pattern>),
|
||||
Optional(Variable, Loc<Expr>),
|
||||
Guard(Variable, Loc<Pattern>),
|
||||
}
|
||||
|
||||
pub fn symbols_from_pattern(pattern: &Pattern) -> Vec<Symbol> {
|
||||
|
@ -104,7 +104,7 @@ pub fn canonicalize_pattern<'a>(
|
|||
pattern_type: PatternType,
|
||||
pattern: &ast::Pattern<'a>,
|
||||
region: Region,
|
||||
) -> (Output, Located<Pattern>) {
|
||||
) -> (Output, Loc<Pattern>) {
|
||||
use roc_parse::ast::Pattern::*;
|
||||
use PatternType::*;
|
||||
|
||||
|
@ -258,7 +258,7 @@ pub fn canonicalize_pattern<'a>(
|
|||
Ok(symbol) => {
|
||||
output.references.bound_symbols.insert(symbol);
|
||||
|
||||
destructs.push(Located {
|
||||
destructs.push(Loc {
|
||||
region: loc_pattern.region,
|
||||
value: RecordDestruct {
|
||||
var: var_store.fresh(),
|
||||
|
@ -297,7 +297,7 @@ pub fn canonicalize_pattern<'a>(
|
|||
|
||||
output.union(new_output);
|
||||
|
||||
destructs.push(Located {
|
||||
destructs.push(Loc {
|
||||
region: loc_pattern.region,
|
||||
value: RecordDestruct {
|
||||
var: var_store.fresh(),
|
||||
|
@ -329,7 +329,7 @@ pub fn canonicalize_pattern<'a>(
|
|||
|
||||
output.union(expr_output);
|
||||
|
||||
destructs.push(Located {
|
||||
destructs.push(Loc {
|
||||
region: loc_pattern.region,
|
||||
value: RecordDestruct {
|
||||
var: var_store.fresh(),
|
||||
|
@ -391,7 +391,7 @@ pub fn canonicalize_pattern<'a>(
|
|||
|
||||
(
|
||||
output,
|
||||
Located {
|
||||
Loc {
|
||||
region,
|
||||
value: can_pattern,
|
||||
},
|
||||
|
@ -432,7 +432,7 @@ fn malformed_pattern(env: &mut Env, problem: MalformedPatternProblem, region: Re
|
|||
|
||||
pub fn bindings_from_patterns<'a, I>(loc_patterns: I) -> Vec<(Symbol, Region)>
|
||||
where
|
||||
I: Iterator<Item = &'a Located<Pattern>>,
|
||||
I: Iterator<Item = &'a Loc<Pattern>>,
|
||||
{
|
||||
let mut answer = Vec::new();
|
||||
|
||||
|
@ -464,7 +464,7 @@ fn add_bindings_from_patterns(
|
|||
}
|
||||
}
|
||||
RecordDestructure { destructs, .. } => {
|
||||
for Located {
|
||||
for Loc {
|
||||
region,
|
||||
value: RecordDestruct { symbol, .. },
|
||||
} in destructs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue