made custom type names case-insensitive

This commit is contained in:
mark 2023-05-11 01:11:12 +02:00
parent 4efee9e2a2
commit 9ec4acaf70

View File

@ -315,11 +315,13 @@ pub fn stype(t: &mut VSingleType, ginfo: &mut GlobalScriptInfo) -> Result<(), To
} }
VSingleType::EnumVariant(_, t) => stypes(t, ginfo)?, VSingleType::EnumVariant(_, t) => stypes(t, ginfo)?,
VSingleType::CustomTypeS(name) => { VSingleType::CustomTypeS(name) => {
*t = VSingleType::CustomType(if let Some(v) = ginfo.custom_type_names.get(name) { *t = VSingleType::CustomType(
*v if let Some(v) = ginfo.custom_type_names.get(&name.to_lowercase()) {
} else { *v
return Err(ToRunnableError::UnknownType(name.to_owned())); } else {
}) return Err(ToRunnableError::UnknownType(name.to_owned()));
},
)
} }
VSingleType::CustomType(_) => (), VSingleType::CustomType(_) => (),
} }
@ -603,7 +605,7 @@ fn statement(
}, statement(s, ginfo, linfo)?), }, statement(s, ginfo, linfo)?),
SStatementEnum::TypeDefinition(name, t) => { SStatementEnum::TypeDefinition(name, t) => {
// insert to name map has to happen before stypes() // insert to name map has to happen before stypes()
ginfo.custom_type_names.insert(name.to_owned(), ginfo.custom_types.len()); ginfo.custom_type_names.insert(name.to_lowercase(), ginfo.custom_types.len());
let mut t = t.to_owned(); let mut t = t.to_owned();
stypes(&mut t, ginfo)?; stypes(&mut t, ginfo)?;
ginfo.custom_types.push(t); ginfo.custom_types.push(t);