From b4e42953e1d243f2eda20e5be6b845d60b7bf688 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Mon, 14 Mar 2022 23:14:15 +0530 Subject: feat(core): codegen ops (#13861) Co-authored-by: Aaron O'Mullan --- cli/ops/errors.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'cli/ops/errors.rs') diff --git a/cli/ops/errors.rs b/cli/ops/errors.rs index a9193b0cd..c215ade41 100644 --- a/cli/ops/errors.rs +++ b/cli/ops/errors.rs @@ -6,7 +6,7 @@ use crate::proc_state::ProcState; use crate::source_maps::get_orig_position; use crate::source_maps::CachedMaps; use deno_core::error::AnyError; -use deno_core::op_sync; +use deno_core::op; use deno_core::serde_json; use deno_core::serde_json::json; use deno_core::serde_json::Value; @@ -19,9 +19,9 @@ use std::collections::HashMap; pub fn init() -> Extension { Extension::builder() .ops(vec![ - ("op_apply_source_map", op_sync(op_apply_source_map)), - ("op_format_diagnostic", op_sync(op_format_diagnostic)), - ("op_format_file_name", op_sync(op_format_file_name)), + op_apply_source_map::decl(), + op_format_diagnostic::decl(), + op_format_file_name::decl(), ]) .build() } @@ -42,6 +42,7 @@ struct AppliedSourceMap { column_number: u32, } +#[op] fn op_apply_source_map( state: &mut OpState, args: ApplySourceMap, @@ -66,6 +67,7 @@ fn op_apply_source_map( }) } +#[op] fn op_format_diagnostic( _state: &mut OpState, args: Value, @@ -75,6 +77,7 @@ fn op_format_diagnostic( Ok(json!(diagnostic.to_string())) } +#[op] fn op_format_file_name( _state: &mut OpState, file_name: String, -- cgit v1.2.3