mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-19 07:32:26 +03:00
unimplemented to unreachable
This commit is contained in:
parent
37b99f84d6
commit
06a6fd9598
@ -21,7 +21,7 @@ use leo_errors::emitter::Handler;
|
||||
use leo_errors::{LeoError, ParserError, Result};
|
||||
use leo_span::{Span, Symbol};
|
||||
|
||||
use std::{borrow::Cow, unimplemented};
|
||||
use std::{borrow::Cow, unreachable};
|
||||
use tendril::format_tendril;
|
||||
|
||||
/// Stores a program in tokenized format plus additional context.
|
||||
@ -156,7 +156,7 @@ impl<'a> ParserContext<'a> {
|
||||
{
|
||||
return Some(Identifier { name, span });
|
||||
} else {
|
||||
unimplemented!()
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
None
|
||||
@ -294,7 +294,7 @@ impl<'a> ParserContext<'a> {
|
||||
{
|
||||
return Some((PositiveNumber { value }, span));
|
||||
} else {
|
||||
unimplemented!()
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
None
|
||||
@ -377,7 +377,7 @@ impl<'a> ParserContext<'a> {
|
||||
{
|
||||
Ok(Identifier { name, span })
|
||||
} else {
|
||||
unimplemented!()
|
||||
unreachable!()
|
||||
}
|
||||
} else {
|
||||
Err(ParserError::unexpected_str(inner, "ident", span).into())
|
||||
|
@ -134,7 +134,7 @@ impl ParserContext<'_> {
|
||||
let op = match op {
|
||||
Token::Eq => BinaryOperation::Eq,
|
||||
Token::NotEq => BinaryOperation::Ne,
|
||||
_ => unimplemented!(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
expr = Self::bin_expr(expr, right, op);
|
||||
}
|
||||
@ -155,7 +155,7 @@ impl ParserContext<'_> {
|
||||
Token::LtEq => BinaryOperation::Le,
|
||||
Token::Gt => BinaryOperation::Gt,
|
||||
Token::GtEq => BinaryOperation::Ge,
|
||||
_ => unimplemented!(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
expr = Self::bin_expr(expr, right, op);
|
||||
}
|
||||
@ -173,7 +173,7 @@ impl ParserContext<'_> {
|
||||
let op = match op {
|
||||
Token::Add => BinaryOperation::Add,
|
||||
Token::Minus => BinaryOperation::Sub,
|
||||
_ => unimplemented!(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
expr = Self::bin_expr(expr, right, op);
|
||||
}
|
||||
@ -191,8 +191,7 @@ impl ParserContext<'_> {
|
||||
let op = match op {
|
||||
Token::Mul => BinaryOperation::Mul,
|
||||
Token::Div => BinaryOperation::Div,
|
||||
// Token::Mod => BinaryOperation::Mod,
|
||||
_ => unimplemented!(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
expr = Self::bin_expr(expr, right, op);
|
||||
}
|
||||
@ -250,7 +249,7 @@ impl ParserContext<'_> {
|
||||
Token::Not => UnaryOperation::Not,
|
||||
Token::Minus => UnaryOperation::Negate,
|
||||
// Token::BitNot => UnaryOperation::BitNot,
|
||||
_ => unimplemented!(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
// hack for const signed integer overflow issues
|
||||
if matches!(operation, UnaryOperation::Negate) {
|
||||
@ -381,7 +380,7 @@ impl ParserContext<'_> {
|
||||
name: ident,
|
||||
}));
|
||||
}
|
||||
_ => unimplemented!(),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
Ok(expr)
|
||||
|
@ -27,7 +27,7 @@ use leo_errors::{ParserError, Result};
|
||||
use leo_span::{Span, Symbol};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use std::unimplemented;
|
||||
use std::unreachable;
|
||||
|
||||
mod context;
|
||||
pub use context::*;
|
||||
|
@ -115,7 +115,7 @@ impl ParserContext<'_> {
|
||||
Token::MulEq => AssignOperation::Mul,
|
||||
Token::DivEq => AssignOperation::Div,
|
||||
Token::ExpEq => AssignOperation::Pow,
|
||||
_ => unimplemented!(),
|
||||
_ => unreachable!(),
|
||||
},
|
||||
value,
|
||||
})))
|
||||
@ -317,7 +317,7 @@ impl ParserContext<'_> {
|
||||
declaration_type: match declare.token {
|
||||
Token::Let => Declare::Let,
|
||||
Token::Const => Declare::Const,
|
||||
_ => unimplemented!(),
|
||||
_ => unreachable!(),
|
||||
},
|
||||
variable_names,
|
||||
type_,
|
||||
|
Loading…
Reference in New Issue
Block a user