Skip to content

Commit

Permalink
add handling with match - see #116
Browse files Browse the repository at this point in the history
Signed-off-by: n4n5 <its.just.n4n5@gmail.com>
  • Loading branch information
Its-Just-Nans authored and gabhijit committed May 29, 2024
1 parent c9b80c6 commit e536648
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions asn-compiler/src/resolver/asn/types/constructed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,30 @@ fn resolve_sequence_classfield_components(

// Get the Object Set first It's the Same Object Set for all components. So if we get the first
// one that's good enough!
let ty = &all_components[0].ty;
let constraint = &ty.constraints.as_ref().unwrap()[0];
let ty = match all_components.get(0) {
Some(c) => &c.ty,
None => {
return Err(resolve_error!(
"all_components is empty. Expected at-least one component!"
));
}
};
eprintln!("all_components: {:#?}", all_components);
let constraint = match ty.constraints.as_ref() {
Some(c) => match c.get(0) {
Some(c) => c,
None => {
return Err(resolve_error!(
"constraints is empty. Expected at-least one constraint!"
));
}
},
None => {
return Err(resolve_error!(
"Expected Sequence with at-least one ClassField Reference Component!. Found Empty Sequences"
));
}
};

let set_reference = constraint.get_set_reference()?;

Expand Down

0 comments on commit e536648

Please sign in to comment.