Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve extension! macro #881

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

magurotuna
Copy link
Member

@magurotuna magurotuna commented Aug 23, 2024

This commit makes the following refinements for extension! macro:

  • Improve the doc comments to cover all the fields available now (i.e. external_references and customizer)
  • Fix the wrong field name in the doc (config -> options)
  • Fix the compile error regarding a wrong expansion of repetitive external_references elements
  • Let it correctly handle the cases where options are provided but state_fn is 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)

@CLAassistant
Copy link

CLAassistant commented Aug 23, 2024

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants