mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Support underscore assignments in roc_ast
This commit is contained in:
parent
cb42d9b076
commit
e20b5f6ee1
1 changed files with 1 additions and 14 deletions
|
@ -171,10 +171,7 @@ pub fn to_pattern2<'a>(
|
||||||
malformed_pattern(env, problem, region)
|
malformed_pattern(env, problem, region)
|
||||||
}
|
}
|
||||||
|
|
||||||
Underscore(_) => match pattern_type {
|
Underscore(_) => Pattern2::Underscore,
|
||||||
WhenBranch | FunctionArg => Pattern2::Underscore,
|
|
||||||
TopLevelDef | DefExpr => underscore_in_def(env, region),
|
|
||||||
},
|
|
||||||
|
|
||||||
FloatLiteral(ref string) => match pattern_type {
|
FloatLiteral(ref string) => match pattern_type {
|
||||||
WhenBranch => match finish_parsing_float(string) {
|
WhenBranch => match finish_parsing_float(string) {
|
||||||
|
@ -591,16 +588,6 @@ fn unsupported_pattern<'a>(
|
||||||
Pattern2::UnsupportedPattern(region)
|
Pattern2::UnsupportedPattern(region)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn underscore_in_def<'a>(env: &mut Env<'a>, region: Region) -> Pattern2 {
|
|
||||||
use roc_problem::can::BadPattern;
|
|
||||||
env.problem(Problem::UnsupportedPattern(
|
|
||||||
BadPattern::UnderscoreInDef,
|
|
||||||
region,
|
|
||||||
));
|
|
||||||
|
|
||||||
Pattern2::UnsupportedPattern(region)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn flatten_str_literal(pool: &mut Pool, literal: &StrLiteral<'_>) -> Pattern2 {
|
pub(crate) fn flatten_str_literal(pool: &mut Pool, literal: &StrLiteral<'_>) -> Pattern2 {
|
||||||
use roc_parse::ast::StrLiteral::*;
|
use roc_parse::ast::StrLiteral::*;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue