lang: Handle underscores when parsing array sizes (#656)

This commit is contained in:
Tom Linton 2021-09-02 09:07:23 +12:00 committed by GitHub
parent b6720be3ce
commit afa218f797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -159,7 +159,12 @@ impl std::str::FromStr for IdlType {
let inner = &inner[..inner.len() - 1];
let mut parts = inner.split(';');
let ty = IdlType::from_str(parts.next().unwrap()).unwrap();
let len = parts.next().unwrap().parse::<usize>().unwrap();
let len = parts
.next()
.unwrap()
.replace("_", "")
.parse::<usize>()
.unwrap();
assert!(parts.next().is_none());
IdlType::Array(Box::new(ty), len)
}