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