nac3core: remove previous handling of None
not to confuse with option none, and the None token is parsed as a special ast::constant instead of an ast::name so the handling is invalid
This commit is contained in:
parent
38f856e956
commit
be6b6c9440
@ -153,12 +153,11 @@ pub trait SymbolResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static IDENTIFIER_ID: [StrRef; 12] = [
|
static IDENTIFIER_ID: [StrRef; 11] = [
|
||||||
"int32".into(),
|
"int32".into(),
|
||||||
"int64".into(),
|
"int64".into(),
|
||||||
"float".into(),
|
"float".into(),
|
||||||
"bool".into(),
|
"bool".into(),
|
||||||
"None".into(),
|
|
||||||
"virtual".into(),
|
"virtual".into(),
|
||||||
"list".into(),
|
"list".into(),
|
||||||
"tuple".into(),
|
"tuple".into(),
|
||||||
@ -183,14 +182,13 @@ pub fn parse_type_annotation<T>(
|
|||||||
let int64_id = ids[1];
|
let int64_id = ids[1];
|
||||||
let float_id = ids[2];
|
let float_id = ids[2];
|
||||||
let bool_id = ids[3];
|
let bool_id = ids[3];
|
||||||
let none_id = ids[4];
|
let virtual_id = ids[4];
|
||||||
let virtual_id = ids[5];
|
let list_id = ids[5];
|
||||||
let list_id = ids[6];
|
let tuple_id = ids[6];
|
||||||
let tuple_id = ids[7];
|
let str_id = ids[7];
|
||||||
let str_id = ids[8];
|
let exn_id = ids[8];
|
||||||
let exn_id = ids[9];
|
let uint32_id = ids[9];
|
||||||
let uint32_id = ids[10];
|
let uint64_id = ids[10];
|
||||||
let uint64_id = ids[11];
|
|
||||||
|
|
||||||
let name_handling = |id: &StrRef, loc: Location, unifier: &mut Unifier| {
|
let name_handling = |id: &StrRef, loc: Location, unifier: &mut Unifier| {
|
||||||
if *id == int32_id {
|
if *id == int32_id {
|
||||||
@ -205,8 +203,6 @@ pub fn parse_type_annotation<T>(
|
|||||||
Ok(primitives.float)
|
Ok(primitives.float)
|
||||||
} else if *id == bool_id {
|
} else if *id == bool_id {
|
||||||
Ok(primitives.bool)
|
Ok(primitives.bool)
|
||||||
} else if *id == none_id {
|
|
||||||
Ok(primitives.none)
|
|
||||||
} else if *id == str_id {
|
} else if *id == str_id {
|
||||||
Ok(primitives.str)
|
Ok(primitives.str)
|
||||||
} else if *id == exn_id {
|
} else if *id == exn_id {
|
||||||
|
@ -1784,9 +1784,7 @@ impl TopLevelComposer {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
let mut identifiers = {
|
let mut identifiers = {
|
||||||
// NOTE: none and function args?
|
|
||||||
let mut result: HashSet<_> = HashSet::new();
|
let mut result: HashSet<_> = HashSet::new();
|
||||||
result.insert("None".into());
|
|
||||||
if self_type.is_some() {
|
if self_type.is_some() {
|
||||||
result.insert("self".into());
|
result.insert("self".into());
|
||||||
}
|
}
|
||||||
@ -1809,9 +1807,7 @@ impl TopLevelComposer {
|
|||||||
},
|
},
|
||||||
unifier,
|
unifier,
|
||||||
variable_mapping: {
|
variable_mapping: {
|
||||||
// NOTE: none and function args?
|
|
||||||
let mut result: HashMap<StrRef, Type> = HashMap::new();
|
let mut result: HashMap<StrRef, Type> = HashMap::new();
|
||||||
result.insert("None".into(), primitives_ty.none);
|
|
||||||
if let Some(self_ty) = self_type {
|
if let Some(self_ty) = self_type {
|
||||||
result.insert("self".into(), self_ty);
|
result.insert("self".into(), self_ty);
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,6 @@ pub fn parse_ast_to_type_annotation_kinds<T>(
|
|||||||
Ok(TypeAnnotation::Primitive(primitives.float))
|
Ok(TypeAnnotation::Primitive(primitives.float))
|
||||||
} else if id == &"bool".into() {
|
} else if id == &"bool".into() {
|
||||||
Ok(TypeAnnotation::Primitive(primitives.bool))
|
Ok(TypeAnnotation::Primitive(primitives.bool))
|
||||||
} else if id == &"None".into() {
|
|
||||||
Ok(TypeAnnotation::Primitive(primitives.none))
|
|
||||||
} else if id == &"str".into() {
|
} else if id == &"str".into() {
|
||||||
Ok(TypeAnnotation::Primitive(primitives.str))
|
Ok(TypeAnnotation::Primitive(primitives.str))
|
||||||
} else if id == &"Exception".into() {
|
} else if id == &"Exception".into() {
|
||||||
|
Loading…
Reference in New Issue
Block a user