fix : parsing in record fields

This commit is contained in:
vms 2020-11-08 19:36:33 +03:00
parent 5569b9ab62
commit 552d4b7141
3 changed files with 15 additions and 3 deletions

2
Cargo.lock generated
View File

@ -161,7 +161,7 @@ checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
[[package]]
name = "wasmer-interface-types-fl"
version = "0.17.16"
version = "0.17.17"
dependencies = [
"log",
"nom",

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-interface-types-fl"
version = "0.17.16"
version = "0.17.17"
description = "WebAssembly Interface Types library for Wasmer"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]

View File

@ -184,9 +184,21 @@ impl Parse<'_> for RecordType {
})?
.to_string();
if !name.ends_with(':') {
parser.step(|cursor| {
if let Some((":", rest)) = cursor.reserved() {
return Ok(("", rest));
}
Err(cursor.error("expected : between an argument and a type"))
})?;
}
let ty = parser.parse()?;
fields.push(RecordFieldType { name, ty });
fields.push(RecordFieldType {
name: name.trim_end_matches(":").to_string(),
ty,
});
}
Ok(())
})?;