diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2022-03-14 23:14:15 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 18:44:15 +0100 |
commit | b4e42953e1d243f2eda20e5be6b845d60b7bf688 (patch) | |
tree | 10b3bfff165f9c04f9174c7c399d44b9b724c3b3 /ext/url/lib.rs | |
parent | 4e3ed37037a2aa1edeac260dc3463a81d9cf9b88 (diff) |
feat(core): codegen ops (#13861)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
Diffstat (limited to 'ext/url/lib.rs')
-rw-r--r-- | ext/url/lib.rs | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/ext/url/lib.rs b/ext/url/lib.rs index f8d659f00..a82b3e702 100644 --- a/ext/url/lib.rs +++ b/ext/url/lib.rs @@ -7,7 +7,7 @@ use deno_core::error::type_error; use deno_core::error::uri_error; use deno_core::error::AnyError; use deno_core::include_js_files; -use deno_core::op_sync; +use deno_core::op; use deno_core::url::form_urlencoded; use deno_core::url::quirks; use deno_core::url::Url; @@ -26,21 +26,12 @@ pub fn init() -> Extension { "01_urlpattern.js", )) .ops(vec![ - ("op_url_parse", op_sync(op_url_parse)), - ("op_url_reparse", op_sync(op_url_reparse)), - ( - "op_url_parse_search_params", - op_sync(op_url_parse_search_params), - ), - ( - "op_url_stringify_search_params", - op_sync(op_url_stringify_search_params), - ), - ("op_urlpattern_parse", op_sync(op_urlpattern_parse)), - ( - "op_urlpattern_process_match_input", - op_sync(op_urlpattern_process_match_input), - ), + op_url_parse::decl(), + op_url_reparse::decl(), + op_url_parse_search_params::decl(), + op_url_stringify_search_params::decl(), + op_urlpattern_parse::decl(), + op_urlpattern_process_match_input::decl(), ]) .build() } @@ -65,6 +56,7 @@ type UrlParts = String; /// Parse `UrlParseArgs::href` with an optional `UrlParseArgs::base_href`, or an /// optional part to "set" after parsing. Return `UrlParts`. +#[op] pub fn op_url_parse( _state: &mut deno_core::OpState, href: String, @@ -98,6 +90,7 @@ pub enum UrlSetter { Username = 9, } +#[op] pub fn op_url_reparse( _state: &mut deno_core::OpState, href: String, @@ -167,6 +160,7 @@ fn url_result( ) } +#[op] pub fn op_url_parse_search_params( _state: &mut deno_core::OpState, args: Option<String>, @@ -186,6 +180,7 @@ pub fn op_url_parse_search_params( Ok(params) } +#[op] pub fn op_url_stringify_search_params( _state: &mut deno_core::OpState, args: Vec<(String, String)>, |