nothing variable (#527)

* nothing variable

* corrected comments

* added color to nothing like bool

* compare nothing with values

* comparison tests
This commit is contained in:
Fernando Herrera
2021-12-20 01:05:33 +00:00
committed by GitHub
parent ff5b7e5ad2
commit e949658381
11 changed files with 167 additions and 152 deletions

View File

@ -7,6 +7,7 @@ use std::fmt::{Display, Formatter, Result};
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd)]
pub enum FlatShape {
Garbage,
Nothing,
Bool,
Int,
Float,
@ -29,6 +30,7 @@ impl Display for FlatShape {
fn fmt(&self, f: &mut Formatter) -> Result {
match self {
FlatShape::Garbage => write!(f, "flatshape_garbage"),
FlatShape::Nothing => write!(f, "flatshape_nothing"),
FlatShape::Bool => write!(f, "flatshape_bool"),
FlatShape::Int => write!(f, "flatshape_int"),
FlatShape::Float => write!(f, "flatshape_float"),
@ -127,6 +129,9 @@ pub fn flatten_expression(
Expr::Garbage => {
vec![(expr.span, FlatShape::Garbage)]
}
Expr::Nothing => {
vec![(expr.span, FlatShape::Nothing)]
}
Expr::Int(_) => {
vec![(expr.span, FlatShape::Int)]
}