summaryrefslogtreecommitdiff
path: root/ops/attrs.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-07-01 18:00:14 -0600
committerGitHub <noreply@github.com>2023-07-02 00:00:14 +0000
commite746b6d80654ba4e4e26370fe6e4f784ce841d92 (patch)
tree153ffad92a96126b9ab8e906dcdabf7648755931 /ops/attrs.rs
parentb9c0e7cd550ab14fa7da7e33ed87cbeeeb9785a0 (diff)
refactor(core): Extract deno_core (#19658)
`deno_core` is moving out! You'll find it at https://github.com/denoland/deno_core/ once this PR lands.
Diffstat (limited to 'ops/attrs.rs')
-rw-r--r--ops/attrs.rs54
1 files changed, 0 insertions, 54 deletions
diff --git a/ops/attrs.rs b/ops/attrs.rs
deleted file mode 100644
index d0182fc69..000000000
--- a/ops/attrs.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-use syn::parse::Parse;
-use syn::parse::ParseStream;
-use syn::Error;
-use syn::Ident;
-use syn::Result;
-use syn::Token;
-
-#[derive(Clone, Debug, Default)]
-pub struct Attributes {
- pub is_unstable: bool,
- pub is_v8: bool,
- pub must_be_fast: bool,
- pub deferred: bool,
- pub is_wasm: bool,
- pub relation: Option<Ident>,
-}
-
-impl Parse for Attributes {
- fn parse(input: ParseStream) -> Result<Self> {
- let mut self_ = Self::default();
- let mut fast = false;
- while let Ok(v) = input.parse::<Ident>() {
- match v.to_string().as_str() {
- "unstable" => self_.is_unstable = true,
- "v8" => self_.is_v8 = true,
- "fast" => fast = true,
- "deferred" => self_.deferred = true,
- "wasm" => self_.is_wasm = true,
- "slow" => {
- if !fast {
- return Err(Error::new(
- input.span(),
- "relational attributes can only be used with fast attribute",
- ));
- }
- input.parse::<Token![=]>()?;
- self_.relation = Some(input.parse()?);
- }
- _ => {
- return Err(Error::new(
- input.span(),
- "invalid attribute, expected one of: unstable, v8, fast, deferred, wasm",
- ));
- }
- };
- let _ = input.parse::<Token![,]>();
- }
-
- self_.must_be_fast = self_.is_wasm || fast;
-
- Ok(self_)
- }
-}