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

refactor: reduce cfg_attr boilerplate with SerAttrs derive #2669

Merged

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Mar 10, 2024

Closes #2641.

Also added tsify attribute to the SerAttrs derive macro, so #[cfg_attr(feature = "wasm", tsify(...))] can also be reduced to #[tsify(...)].

Copy link

codspeed-hq bot commented Mar 10, 2024

CodSpeed Performance Report

Merging #2669 will not alter performance

Comparing 03-10-refactor_reduce_cfg_attr_boilerplate_with_SerAttrs_derive (0cec2c0) with main (f27db30)

Summary

✅ 29 untouched benchmarks

@overlookmotel overlookmotel force-pushed the 03-10-fix_ast_fix_TS_type_for_AssignmentTargetRest_ branch from bf0b2eb to dccedc5 Compare March 10, 2024 17:15
@overlookmotel overlookmotel force-pushed the 03-10-refactor_reduce_cfg_attr_boilerplate_with_SerAttrs_derive branch from 269b0be to 2cb5b4d Compare March 10, 2024 17:15
@Boshen Boshen force-pushed the 03-10-fix_ast_fix_TS_type_for_AssignmentTargetRest_ branch from dccedc5 to 3b12bfd Compare March 11, 2024 04:37
Base automatically changed from 03-10-fix_ast_fix_TS_type_for_AssignmentTargetRest_ to main March 11, 2024 04:42
@Boshen Boshen force-pushed the 03-10-refactor_reduce_cfg_attr_boilerplate_with_SerAttrs_derive branch from 2cb5b4d to 0cec2c0 Compare March 11, 2024 05:21
Copy link
Member

Boshen commented Mar 11, 2024

Merge activity

  • Mar 11, 1:38 AM EDT: @Boshen started a stack merge that includes this pull request via Graphite.
  • Mar 11, 1:38 AM EDT: @Boshen merged this pull request with Graphite.

@Boshen Boshen merged commit 3c1e0db into main Mar 11, 2024
20 checks passed
@Boshen Boshen deleted the 03-10-refactor_reduce_cfg_attr_boilerplate_with_SerAttrs_derive branch March 11, 2024 05:38
overlookmotel added a commit that referenced this pull request Mar 13, 2024
Add `SerAttrs` derive to a few types that I missed out in #2669.
overlookmotel added a commit that referenced this pull request Jul 20, 2024
Remove a ton of `#[cfg_attr(feature = "serialize", serde(...))]` boilerplate from AST type definitions.

Before: `#[cfg_attr(feature = "serialize", serde(flatten))]`
After: `#[serde(flatten)]`

This is a reprise of #2669, which was later reverted, but this time doing it using our existing zero-cost `#[ast]` dummy macro attr, so no compile time penalty this time around.

This makes no difference to either runtime or compile time behavior, purely removes the `cfg_attr` boilerplate and makes the code easier to read.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ast Area - AST A-semantic Area - Semantic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor(ast): add a container macro to AST nodes
2 participants