Skip to content

Commit

Permalink
Merge pull request #523 from veryl-lang/fix_crash
Browse files Browse the repository at this point in the history
Fix crash at unresolve error
  • Loading branch information
dalance committed Mar 6, 2024
2 parents c90958a + f8e413e commit bdb7fc7
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions crates/analyzer/src/handlers/check_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,17 @@ impl<'a> VerylGrammarTrait for CheckModule<'a> {
if self.in_module {
if let HandlerPoint::Before = self.point {
if let IdentifierStatementGroup::Assignment(_) = &*arg.identifier_statement_group {
let symb = match symbol_table::resolve(arg.expression_identifier.as_ref()) {
match symbol_table::resolve(arg.expression_identifier.as_ref()) {

Check failure on line 92 in crates/analyzer/src/handlers/check_module.rs

View workflow job for this annotation

GitHub Actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
Ok(x) => match x.found {
ResolveSymbol::Symbol(x) => x,
ResolveSymbol::Symbol(x) => {
let token = &arg.expression_identifier.identifier.identifier_token;
self.assign_check_inputs(&x, token);
}
// External symbol can't be checkd
ResolveSymbol::External => return Ok(()),
ResolveSymbol::External => (),
},
Err(_) => panic!(),
};
let token = &arg.expression_identifier.identifier.identifier_token;
self.assign_check_inputs(&symb, token);
Err(_) => (),
}
}
}
}
Expand All @@ -112,16 +113,17 @@ impl<'a> VerylGrammarTrait for CheckModule<'a> {
if let HandlerPoint::Before = self.point {
match &*arg.port_declaration_item_group {
PortDeclarationItemGroup::DirectionArrayType(x) => {
let id = match symbol_table::resolve(arg.identifier.as_ref()) {
Ok(x) => match x.found {
ResolveSymbol::Symbol(x) => x.id,
match symbol_table::resolve(arg.identifier.as_ref()) {

Check failure on line 116 in crates/analyzer/src/handlers/check_module.rs

View workflow job for this annotation

GitHub Actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
Ok(y) => match y.found {
ResolveSymbol::Symbol(y) => {
if let Direction::Input(_) = &*x.direction {
self.inputs.push((y.id, 0));
}
}
// External symbol can't be checkd
ResolveSymbol::External => return Ok(()),
ResolveSymbol::External => (),
},
Err(_) => panic!(),
};
if let Direction::Input(_) = &*x.direction {
self.inputs.push((id, 0));
Err(_) => (),
}
// TODO: Cover Inout, Ref, Outputs, and Modports for checking
}
Expand All @@ -135,16 +137,17 @@ impl<'a> VerylGrammarTrait for CheckModule<'a> {
fn assign_declaration(&mut self, arg: &AssignDeclaration) -> Result<(), ParolError> {
if self.in_module {
if let HandlerPoint::Before = self.point {
let symb = match symbol_table::resolve(arg.hierarchical_identifier.as_ref()) {
match symbol_table::resolve(arg.hierarchical_identifier.as_ref()) {

Check failure on line 140 in crates/analyzer/src/handlers/check_module.rs

View workflow job for this annotation

GitHub Actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
Ok(x) => match x.found {
ResolveSymbol::Symbol(x) => x,
ResolveSymbol::Symbol(x) => {
let token = &arg.hierarchical_identifier.identifier.identifier_token;
self.assign_check_inputs(&x, token);
}
// External symbol can't be checkd
ResolveSymbol::External => return Ok(()),
ResolveSymbol::External => (),
},
Err(_) => panic!(),
};
let token = &arg.hierarchical_identifier.identifier.identifier_token;
self.assign_check_inputs(&symb, token);
Err(_) => (),
}
}
}
Ok(())
Expand Down

0 comments on commit bdb7fc7

Please sign in to comment.