wasmparser
Advanced tools
| { | ||
| "git": { | ||
| "sha1": "dafe42f8f543ca76429d5ef7b5e84f41ae8e73fe" | ||
| "sha1": "a1712da0354bea5a38275d7ddf30f707b5757a68" | ||
| }, | ||
| "path_in_vcs": "crates/wasmparser" | ||
| } |
+1
-1
@@ -592,3 +592,3 @@ # This file is automatically @generated by Cargo. | ||
| name = "wasmparser" | ||
| version = "0.240.0" | ||
| version = "0.241.2" | ||
| dependencies = [ | ||
@@ -595,0 +595,0 @@ "anyhow", |
+1
-1
@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "wasmparser" | ||
| version = "0.240.0" | ||
| version = "0.241.2" | ||
| authors = ["Yury Delendik <ydelendik@mozilla.com>"] | ||
@@ -19,0 +19,0 @@ build = "build.rs" |
@@ -48,3 +48,3 @@ use crate::{BinaryReader, BinaryReaderError, NameMap, Result, Subsection, Subsections}; | ||
| 0 => { | ||
| let name = reader.read_string()?; | ||
| let name = reader.read_unlimited_string()?; | ||
| if !reader.eof() { | ||
@@ -51,0 +51,0 @@ return Err(BinaryReaderError::new( |
@@ -285,3 +285,3 @@ use crate::limits::*; | ||
| }, | ||
| 0x40 => { | ||
| byte @ (0x40 | 0x43) => { | ||
| let params = reader | ||
@@ -291,3 +291,7 @@ .read_iter(MAX_WASM_FUNCTION_PARAMS, "component function parameters")? | ||
| let result = read_resultlist(reader)?; | ||
| ComponentType::Func(ComponentFuncType { params, result }) | ||
| ComponentType::Func(ComponentFuncType { | ||
| async_: byte == 0x43, | ||
| params, | ||
| result, | ||
| }) | ||
| } | ||
@@ -392,2 +396,4 @@ 0x41 => ComponentType::Component( | ||
| pub struct ComponentFuncType<'a> { | ||
| /// Whether or not this is an async function. | ||
| pub async_: bool, | ||
| /// The function parameters. | ||
@@ -394,0 +400,0 @@ pub params: Box<[(&'a str, ComponentValType)]>, |
@@ -32,3 +32,3 @@ use crate::{BinaryReader, FromReader, Result}; | ||
| } | ||
| let name = reader.read_string()?; | ||
| let name = reader.read_unlimited_string()?; | ||
| if !reader.eof() { | ||
@@ -73,3 +73,3 @@ bail!( | ||
| } | ||
| modules.push(reader.read_string()?); | ||
| modules.push(reader.read_unlimited_string()?); | ||
| } | ||
@@ -186,3 +186,3 @@ if !reader.eof() { | ||
| } | ||
| let name = reader.read_string()?; | ||
| let name = reader.read_unlimited_string()?; | ||
| let mut frames = vec![]; | ||
@@ -189,0 +189,0 @@ for _ in 0..reader.read_var_u32()? { |
@@ -81,3 +81,3 @@ use crate::prelude::*; | ||
| (0..reader.read_var_u32()?) | ||
| .map(|_| reader.read_string()) | ||
| .map(|_| reader.read_unlimited_string()) | ||
| .collect::<Result<_, _>>()?, | ||
@@ -89,3 +89,3 @@ ), | ||
| Ok(ExportInfo { | ||
| name: reader.read_string()?, | ||
| name: reader.read_unlimited_string()?, | ||
| flags: reader.read()?, | ||
@@ -100,4 +100,4 @@ }) | ||
| Ok(ImportInfo { | ||
| module: reader.read_string()?, | ||
| field: reader.read_string()?, | ||
| module: reader.read_unlimited_string()?, | ||
| field: reader.read_unlimited_string()?, | ||
| flags: reader.read()?, | ||
@@ -110,3 +110,3 @@ }) | ||
| (0..reader.read_var_u32()?) | ||
| .map(|_| reader.read_string()) | ||
| .map(|_| reader.read_unlimited_string()) | ||
| .collect::<Result<_, _>>()?, | ||
@@ -113,0 +113,0 @@ ), |
@@ -49,3 +49,3 @@ /* Copyright 2019 Mozilla Foundation | ||
| let offset = reader.original_position(); | ||
| let name = reader.read_string()?; | ||
| let name = reader.read_unlimited_string()?; | ||
| match name { | ||
@@ -81,6 +81,6 @@ "language" | "sdk" | "processed-by" => {} | ||
| fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> { | ||
| let name = reader.read_string()?; | ||
| let version = reader.read_string()?; | ||
| let name = reader.read_unlimited_string()?; | ||
| let version = reader.read_unlimited_string()?; | ||
| Ok(ProducersFieldValue { name, version }) | ||
| } | ||
| } |
+24
-61
@@ -56,2 +56,4 @@ //! Definitions of name-related helpers and newtypes, primarily for the | ||
| let mut upper = false; | ||
| let mut is_first = true; | ||
| let mut has_digit = false; | ||
| for c in self.chars() { | ||
@@ -61,8 +63,11 @@ match c { | ||
| 'A'..='Z' if !lower && !upper => upper = true, | ||
| '0'..='9' if !lower && !upper && !is_first => has_digit = true, | ||
| 'a'..='z' if lower => {} | ||
| 'A'..='Z' if upper => {} | ||
| '0'..='9' if lower || upper => {} | ||
| '-' if lower || upper => { | ||
| '0'..='9' if lower || upper => has_digit = true, | ||
| '-' if lower || upper || has_digit => { | ||
| lower = false; | ||
| upper = false; | ||
| is_first = false; | ||
| has_digit = false; | ||
| } | ||
@@ -242,5 +247,2 @@ _ => return false, | ||
| /// * a plain constructor: `[constructor]a-b` | ||
| /// * an async plain label: `[async]a-b-c` | ||
| /// * an async plain method name : `[async method]a-b.c-d` | ||
| /// * an async plain static method name : `[async static]a-b.c-d` | ||
| /// * an interface name: `wasi:cli/reactor@0.1.0` | ||
@@ -272,5 +274,2 @@ /// * a dependency name: `locked-dep=foo:bar/baz` | ||
| Hash, | ||
| AsyncLabel, | ||
| AsyncMethod, | ||
| AsyncStatic, | ||
| } | ||
@@ -303,10 +302,2 @@ | ||
| Hash(HashName<'a>), | ||
| /// `[async]a-b-c` | ||
| AsyncLabel(&'a KebabStr), | ||
| /// `[async method]a-b.c-d` | ||
| #[allow(missing_docs)] | ||
| AsyncMethod(ResourceFunc<'a>), | ||
| /// `[async static]a-b.c-d` | ||
| #[allow(missing_docs)] | ||
| AsyncStatic(ResourceFunc<'a>), | ||
| } | ||
@@ -317,5 +308,2 @@ | ||
| const STATIC: &str = "[static]"; | ||
| const ASYNC: &str = "[async]"; | ||
| const ASYNC_METHOD: &str = "[async method]"; | ||
| const ASYNC_STATIC: &str = "[async static]"; | ||
@@ -356,8 +344,5 @@ impl ComponentName { | ||
| PK::Label => Label(KebabStr::new_unchecked(&self.raw)), | ||
| PK::AsyncLabel => AsyncLabel(KebabStr::new_unchecked(&self.raw[ASYNC.len()..])), | ||
| PK::Constructor => Constructor(KebabStr::new_unchecked(&self.raw[CONSTRUCTOR.len()..])), | ||
| PK::Method => Method(ResourceFunc(&self.raw[METHOD.len()..])), | ||
| PK::AsyncMethod => AsyncMethod(ResourceFunc(&self.raw[ASYNC_METHOD.len()..])), | ||
| PK::Static => Static(ResourceFunc(&self.raw[STATIC.len()..])), | ||
| PK::AsyncStatic => AsyncStatic(ResourceFunc(&self.raw[ASYNC_STATIC.len()..])), | ||
| PK::Interface => Interface(InterfaceName(&self.raw)), | ||
@@ -432,5 +417,2 @@ PK::Dependency => Dependency(DependencyName(&self.raw)), | ||
| Self::Hash(_) => ParsedComponentNameKind::Hash, | ||
| Self::AsyncLabel(_) => ParsedComponentNameKind::AsyncLabel, | ||
| Self::AsyncMethod(_) => ParsedComponentNameKind::AsyncMethod, | ||
| Self::AsyncStatic(_) => ParsedComponentNameKind::AsyncStatic, | ||
| } | ||
@@ -445,18 +427,13 @@ } | ||
| match (self, other) { | ||
| (Label(lhs) | AsyncLabel(lhs), Label(rhs) | AsyncLabel(rhs)) => lhs.cmp(rhs), | ||
| (Label(lhs), Label(rhs)) => lhs.cmp(rhs), | ||
| (Constructor(lhs), Constructor(rhs)) => lhs.cmp(rhs), | ||
| ( | ||
| Method(lhs) | AsyncMethod(lhs) | Static(lhs) | AsyncStatic(lhs), | ||
| Method(rhs) | AsyncMethod(rhs) | Static(rhs) | AsyncStatic(rhs), | ||
| ) => lhs.cmp(rhs), | ||
| (Method(lhs) | Static(lhs), Method(rhs) | Static(rhs)) => lhs.cmp(rhs), | ||
| // `[..]l.l` is equivalent to `l` and `[async]l`. | ||
| ( | ||
| Label(plain) | AsyncLabel(plain), | ||
| Method(method) | AsyncMethod(method) | Static(method) | AsyncStatic(method), | ||
| ) | ||
| | ( | ||
| Method(method) | AsyncMethod(method) | Static(method) | AsyncStatic(method), | ||
| Label(plain) | AsyncLabel(plain), | ||
| ) if *plain == method.resource() && *plain == method.method() => Ordering::Equal, | ||
| // `[..]l.l` is equivalent to `l` | ||
| (Label(plain), Method(method) | Static(method)) | ||
| | (Method(method) | Static(method), Label(plain)) | ||
| if *plain == method.resource() && *plain == method.method() => | ||
| { | ||
| Ordering::Equal | ||
| } | ||
@@ -469,8 +446,5 @@ (Interface(lhs), Interface(rhs)) => lhs.cmp(rhs), | ||
| (Label(_), _) | ||
| | (AsyncLabel(_), _) | ||
| | (Constructor(_), _) | ||
| | (Method(_), _) | ||
| | (Static(_), _) | ||
| | (AsyncMethod(_), _) | ||
| | (AsyncStatic(_), _) | ||
| | (Interface(_), _) | ||
@@ -494,6 +468,6 @@ | (Dependency(_), _) | ||
| match self { | ||
| Label(name) | AsyncLabel(name) => (0u8, name).hash(hasher), | ||
| Label(name) => (0u8, name).hash(hasher), | ||
| Constructor(name) => (1u8, name).hash(hasher), | ||
| Method(name) | Static(name) | AsyncMethod(name) | AsyncStatic(name) => { | ||
| Method(name) | Static(name) => { | ||
| // `l.l` hashes the same as `l` since they're equal above, | ||
@@ -639,6 +613,2 @@ // otherwise everything is hashed as `a.b` with a unique | ||
| fn parse(&mut self) -> Result<ParsedComponentNameKind> { | ||
| if self.eat_str(ASYNC) { | ||
| self.expect_kebab()?; | ||
| return Ok(ParsedComponentNameKind::AsyncLabel); | ||
| } | ||
| if self.eat_str(CONSTRUCTOR) { | ||
@@ -660,14 +630,2 @@ self.expect_kebab()?; | ||
| } | ||
| if self.eat_str(ASYNC_METHOD) { | ||
| let resource = self.take_until('.')?; | ||
| self.kebab(resource)?; | ||
| self.expect_kebab()?; | ||
| return Ok(ParsedComponentNameKind::AsyncMethod); | ||
| } | ||
| if self.eat_str(ASYNC_STATIC) { | ||
| let resource = self.take_until('.')?; | ||
| self.kebab(resource)?; | ||
| self.expect_kebab()?; | ||
| return Ok(ParsedComponentNameKind::AsyncStatic); | ||
| } | ||
@@ -1002,3 +960,7 @@ // 'unlocked-dep=<' <pkgnamequery> '>' | ||
| assert!(KebabStr::new("a0").is_some()); | ||
| assert!(KebabStr::new("a-0").is_none()); | ||
| assert!(KebabStr::new("a-0").is_some()); | ||
| assert!(KebabStr::new("0-a").is_none()); | ||
| assert!(KebabStr::new("a-b--c").is_none()); | ||
| assert!(KebabStr::new("a0-000-3d4a-54FF").is_some()); | ||
| assert!(KebabStr::new("a0-000-3d4A-54Ff").is_none()); | ||
| } | ||
@@ -1013,2 +975,3 @@ | ||
| assert!(parse_kebab_name("[method]a.b").is_some()); | ||
| assert!(parse_kebab_name("[method]a-0.b-1").is_some()); | ||
| assert!(parse_kebab_name("[method]a.b.c").is_none()); | ||
@@ -1015,0 +978,0 @@ assert!(parse_kebab_name("[static]a.b").is_some()); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display