From b65b34b0f627b3da5cd5761fe309cefc4980449b Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 17 Jul 2020 10:55:35 +0300 Subject: [PATCH] improve byte_array parsing --- src/decoders/wat.rs | 12 ++++++++++++ src/encoders/wat.rs | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/decoders/wat.rs b/src/decoders/wat.rs index f9a9015..7e91fad 100644 --- a/src/decoders/wat.rs +++ b/src/decoders/wat.rs @@ -325,6 +325,18 @@ impl<'a> Parse<'a> for Instruction { parser.parse::()?; Ok(Instruction::StringSize) + } else if lookahead.peek::() { + parser.parse::()?; + + Ok(Instruction::ByteArrayLiftMemory) + } else if lookahead.peek::() { + parser.parse::()?; + + Ok(Instruction::ByteArrayLowerMemory) + } else if lookahead.peek::() { + parser.parse::()?; + + Ok(Instruction::ByteArraySize) } else if lookahead.peek::() { parser.parse::()?; diff --git a/src/encoders/wat.rs b/src/encoders/wat.rs index 66e1b60..33dfd53 100644 --- a/src/encoders/wat.rs +++ b/src/encoders/wat.rs @@ -73,7 +73,7 @@ impl ToString for &InterfaceType { InterfaceType::F32 => "f32".to_string(), InterfaceType::F64 => "f64".to_string(), InterfaceType::String => "string".to_string(), - InterfaceType::ByteArray => "byteArray".to_string(), + InterfaceType::ByteArray => "byte_array".to_string(), InterfaceType::Anyref => "anyref".to_string(), InterfaceType::I32 => "i32".to_string(), InterfaceType::I64 => "i64".to_string(),