Simplified match
This commit is contained in:
parent
3f1cf1d975
commit
ec7d185ed5
@ -20,7 +20,6 @@ pub enum TConst {
|
|||||||
Custom(String),
|
Custom(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type TypeResult<T> = Result<T, String>;
|
type TypeResult<T> = Result<T, String>;
|
||||||
|
|
||||||
impl TypeContext {
|
impl TypeContext {
|
||||||
@ -77,12 +76,12 @@ impl TypeContext {
|
|||||||
Ok(match anno {
|
Ok(match anno {
|
||||||
&Tuple(_) => return Err(format!("Tuples not yet implemented")),
|
&Tuple(_) => return Err(format!("Tuples not yet implemented")),
|
||||||
&Singleton(ref name) => match name {
|
&Singleton(ref name) => match name {
|
||||||
&TypeSingletonName { ref name, .. } => match **name {
|
&TypeSingletonName { ref name, .. } => match &name[..] {
|
||||||
ref n if n == "Int" => Const(Int),
|
"Int" => Const(Int),
|
||||||
ref n if n == "Float" => Const(Float),
|
"Float" => Const(Float),
|
||||||
ref n if n == "Bool" => Const(Bool),
|
"Bool" => Const(Bool),
|
||||||
ref n if n == "String" => Const(StringT),
|
"String" => Const(StringT),
|
||||||
ref n => Const(Custom((format!("{}", n))))
|
n => Const(Custom(n.to_string()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user