Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Mar 21, 2025

Shorten and simplify some raw_deser code, by using THIS.prop instead of DESER[TypeOfProp](POS_OFFSET.prop).

As well as being shorter, this also results in more efficient deserializer code, as it avoids deserializing the same value twice.

Copy link
Member Author

overlookmotel commented Mar 21, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-ast Area - AST C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Mar 21, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 21, 2025

CodSpeed Instrumentation Performance Report

Merging #9944 will not alter performance

Comparing 03-21-refactor_ast_estree_shorten_raw_deser_code (db642eb) with main (dc3e725)

Summary

✅ 33 untouched benchmarks

@overlookmotel overlookmotel marked this pull request as ready for review March 21, 2025 07:44
@graphite-app graphite-app bot changed the base branch from 03-21-refactor_ast_estree_expose_include_ts_fields_constant_on_serializer_ to graphite-base/9944 March 21, 2025 07:46
@overlookmotel
Copy link
Member Author

overlookmotel commented Mar 21, 2025

@hi-ogawa This may be of interest to you. THIS is usually preferable to DESER, where possible.

You can generally use THIS unless one of:

  1. The field you want the value of is the one which you're converting. i.e. if the converter is for foo field, you can't use THIS.foo in that converter (as it'd be circular logic).
  2. The field you want to get the value of is marked #[estree(skip)].
  3. The other field is later than current field in the struct. (sometimes this is fine, but sometimes not)

I will at some point overhaul these "macros" in raw_deser definitions to make them much simpler, and remove the above restrictions. But for now, this is how it is.

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Mar 21, 2025
Copy link
Member

Boshen commented Mar 21, 2025

Merge activity

  • Mar 21, 3:51 AM EDT: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 21, 3:51 AM EDT: A user added this pull request to the Graphite merge queue.
  • Mar 21, 4:03 AM EDT: A user merged this pull request with the Graphite merge queue.

@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 21, 2025
@graphite-app graphite-app bot changed the base branch from graphite-base/9944 to main March 21, 2025 07:54
Shorten and simplify some `raw_deser` code, by using `THIS.prop` instead of `DESER[TypeOfProp](POS_OFFSET.prop)`.

As well as being shorter, this also results in more efficient deserializer code, as it avoids deserializing the same value twice.
@graphite-app graphite-app bot force-pushed the 03-21-refactor_ast_estree_shorten_raw_deser_code branch from 2a9659e to db642eb Compare March 21, 2025 07:56
@graphite-app graphite-app bot merged commit db642eb into main Mar 21, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 03-21-refactor_ast_estree_shorten_raw_deser_code branch March 21, 2025 08:03
@hi-ogawa
Copy link
Contributor

Thanks! I wasn't aware of THIS. Good to know 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants