mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
store is_negative for all number literals in the parse ast
This commit is contained in:
parent
866fa14590
commit
182fd5201d
12 changed files with 142 additions and 46 deletions
|
@ -646,8 +646,20 @@ fn expr_to_pattern_help<'a>(arena: &'a Bump, expr: &Expr<'a>) -> Result<Pattern<
|
|||
Ok(Pattern::RecordDestructure(loc_patterns.into_bump_slice()))
|
||||
}
|
||||
|
||||
Expr::Float(string) => Ok(Pattern::FloatLiteral(string)),
|
||||
Expr::Num(string) => Ok(Pattern::NumLiteral(string)),
|
||||
Expr::Float {
|
||||
string,
|
||||
is_negative,
|
||||
} => Ok(Pattern::FloatLiteral {
|
||||
string,
|
||||
is_negative: *is_negative,
|
||||
}),
|
||||
Expr::Num {
|
||||
string,
|
||||
is_negative,
|
||||
} => Ok(Pattern::NumLiteral {
|
||||
string,
|
||||
is_negative: *is_negative,
|
||||
}),
|
||||
Expr::NonBase10Int {
|
||||
string,
|
||||
base,
|
||||
|
@ -985,7 +997,7 @@ fn annotation_or_alias<'a>(
|
|||
QualifiedIdentifier { .. } => {
|
||||
Def::NotYetImplemented("TODO gracefully handle trying to annotate a qualified identifier, e.g. `Foo.bar : ...`")
|
||||
}
|
||||
NumLiteral(_) | NonBase10Literal { .. } | FloatLiteral(_) | StrLiteral(_) => {
|
||||
NumLiteral { ..} | NonBase10Literal { .. } | FloatLiteral { .. } | StrLiteral(_) => {
|
||||
Def::NotYetImplemented("TODO gracefully handle trying to annotate a litera")
|
||||
}
|
||||
Underscore(_) => {
|
||||
|
@ -2361,8 +2373,14 @@ fn number_literal_help<'a>() -> impl Parser<'a, Expr<'a>, Number> {
|
|||
use crate::number_literal::NumLiteral::*;
|
||||
|
||||
match literal {
|
||||
Num(s) => Expr::Num(s),
|
||||
Float(s) => Expr::Float(s),
|
||||
Num(s) => Expr::Num {
|
||||
string: s,
|
||||
is_negative: false,
|
||||
},
|
||||
Float(s) => Expr::Float {
|
||||
string: s,
|
||||
is_negative: false,
|
||||
},
|
||||
NonBase10Int {
|
||||
string,
|
||||
base,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue