Clippy; add compiler check

This commit is contained in:
d0cd 2022-10-12 00:22:55 -05:00
parent 264e60c6ee
commit 1f9f1750fe
2 changed files with 7 additions and 4 deletions

View File

@ -506,9 +506,12 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
.iter()
.find(|member| member.identifier.name == identifier.name)
{
if let Some(expr) = &actual.expression {
self.visit_expression(expr, &Some(type_.clone()));
}
match &actual.expression {
// If `expression` is None, then the member uses the identifier shorthand, e.g. `Foo { a }`
None => self.visit_identifier(&actual.identifier, &Some(type_.clone())),
// Otherwise, visit the associated expression.
Some(expr) => self.visit_expression(expr, &Some(type_.clone())),
};
} else {
self.emit_err(TypeCheckerError::missing_struct_member(
struct_.identifier,

View File

@ -412,7 +412,7 @@ fn analyze_source_file(src: &str, source_file_start_pos: BytePos) -> (Vec<BytePo
let src_bytes = src.as_bytes();
while i < src.len() {
let i_usize = i as usize;
let i_usize = i;
let byte = src_bytes[i_usize];
// How much to advance to get to the next UTF-8 char in the string.