deno_core
deno_core copied to clipboard
fix: improve `extension!` macro
This commit makes the following refinements for extension! macro:
- Improve the doc comments to cover all the fields available now (i.e.
external_referencesandcustomizer) - Fix the wrong field name in the doc (
config->options) - Fix the compile error regarding a wrong expansion of repetitive
external_referenceselements - Let it correctly handle the cases where
optionsare provided butstate_fnis not. For example, the previous implementation emits a compile error for the code below, which is fixed in this patch:
deno_core::extension!(
my_ext,
options = { value: String },
);
error: expected expression, found `;`
--> src/bin/deno_core_extension.rs:15:1
|
15 | / deno_core::extension!(
16 | | my_ext,
17 | | options = { value: String },
18 | | );
| |_^ expected expression
|
= note: this error originates in the macro `$crate::extension` which comes from the expansion of the macro `deno_core::extension` (in Nightly builds, run with -Z macro-backtrace for more info)
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 81.90%. Comparing base (
0c7f83e) to head (4e10dc5). Report is 111 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #881 +/- ##
==========================================
+ Coverage 81.43% 81.90% +0.46%
==========================================
Files 97 98 +1
Lines 23877 24930 +1053
==========================================
+ Hits 19445 20418 +973
- Misses 4432 4512 +80
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
not sure if this is still revevant. closing it for now