diff options
Diffstat (limited to 'ops/attrs.rs')
-rw-r--r-- | ops/attrs.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ops/attrs.rs b/ops/attrs.rs index 95374ef36..4d298d7ed 100644 --- a/ops/attrs.rs +++ b/ops/attrs.rs @@ -11,6 +11,7 @@ pub struct Attributes { pub is_v8: bool, pub must_be_fast: bool, pub deferred: bool, + pub is_wasm: bool, } impl Parse for Attributes { @@ -20,18 +21,22 @@ impl Parse for Attributes { let vars: Vec<_> = vars.iter().map(Ident::to_string).collect(); let vars: Vec<_> = vars.iter().map(String::as_str).collect(); for var in vars.iter() { - if !["unstable", "v8", "fast", "deferred"].contains(var) { + if !["unstable", "v8", "fast", "deferred", "wasm"].contains(var) { return Err(Error::new( input.span(), - "invalid attribute, expected one of: unstable, v8, fast, deferred", + "invalid attribute, expected one of: unstable, v8, fast, deferred, wasm", )); } } + + let is_wasm = vars.contains(&"wasm"); + Ok(Self { is_unstable: vars.contains(&"unstable"), is_v8: vars.contains(&"v8"), - must_be_fast: vars.contains(&"fast"), deferred: vars.contains(&"deferred"), + must_be_fast: is_wasm || vars.contains(&"fast"), + is_wasm, }) } } |