forked from M-Labs/nac3
nac3core: remove previous handling of None
the None token is parsed as a special ast::constant instead of an ast::name, and we use None now as a special value of type Option[Any]
This commit is contained in:
parent
e379238378
commit
06fcbff876
|
@ -145,12 +145,11 @@ pub trait SymbolResolver {
|
|||
}
|
||||
|
||||
thread_local! {
|
||||
static IDENTIFIER_ID: [StrRef; 12] = [
|
||||
static IDENTIFIER_ID: [StrRef; 11] = [
|
||||
"int32".into(),
|
||||
"int64".into(),
|
||||
"float".into(),
|
||||
"bool".into(),
|
||||
"None".into(),
|
||||
"virtual".into(),
|
||||
"list".into(),
|
||||
"tuple".into(),
|
||||
|
@ -175,14 +174,13 @@ pub fn parse_type_annotation<T>(
|
|||
let int64_id = ids[1];
|
||||
let float_id = ids[2];
|
||||
let bool_id = ids[3];
|
||||
let none_id = ids[4];
|
||||
let virtual_id = ids[5];
|
||||
let list_id = ids[6];
|
||||
let tuple_id = ids[7];
|
||||
let str_id = ids[8];
|
||||
let exn_id = ids[9];
|
||||
let uint32_id = ids[10];
|
||||
let uint64_id = ids[11];
|
||||
let virtual_id = ids[4];
|
||||
let list_id = ids[5];
|
||||
let tuple_id = ids[6];
|
||||
let str_id = ids[7];
|
||||
let exn_id = ids[8];
|
||||
let uint32_id = ids[9];
|
||||
let uint64_id = ids[10];
|
||||
|
||||
let name_handling = |id: &StrRef, loc: Location, unifier: &mut Unifier| {
|
||||
if *id == int32_id {
|
||||
|
@ -197,8 +195,6 @@ pub fn parse_type_annotation<T>(
|
|||
Ok(primitives.float)
|
||||
} else if *id == bool_id {
|
||||
Ok(primitives.bool)
|
||||
} else if *id == none_id {
|
||||
Ok(primitives.none)
|
||||
} else if *id == str_id {
|
||||
Ok(primitives.str)
|
||||
} else if *id == exn_id {
|
||||
|
|
|
@ -1748,9 +1748,7 @@ impl TopLevelComposer {
|
|||
})
|
||||
};
|
||||
let mut identifiers = {
|
||||
// NOTE: none and function args?
|
||||
let mut result: HashSet<_> = HashSet::new();
|
||||
result.insert("None".into());
|
||||
if self_type.is_some() {
|
||||
result.insert("self".into());
|
||||
}
|
||||
|
@ -1773,9 +1771,7 @@ impl TopLevelComposer {
|
|||
},
|
||||
unifier,
|
||||
variable_mapping: {
|
||||
// NOTE: none and function args?
|
||||
let mut result: HashMap<StrRef, Type> = HashMap::new();
|
||||
result.insert("None".into(), primitives_ty.none);
|
||||
if let Some(self_ty) = self_type {
|
||||
result.insert("self".into(), self_ty);
|
||||
}
|
||||
|
|
|
@ -72,8 +72,6 @@ pub fn parse_ast_to_type_annotation_kinds<T>(
|
|||
Ok(TypeAnnotation::Primitive(primitives.float))
|
||||
} else if id == &"bool".into() {
|
||||
Ok(TypeAnnotation::Primitive(primitives.bool))
|
||||
} else if id == &"None".into() {
|
||||
Ok(TypeAnnotation::Primitive(primitives.none))
|
||||
} else if id == &"str".into() {
|
||||
Ok(TypeAnnotation::Primitive(primitives.str))
|
||||
} else if id == &"Exception".into() {
|
||||
|
|
Loading…
Reference in New Issue