Skip to content

Comments

feat(syntax): add AssignmentOperator::to_logical_operator and to_binary_operator methods#7350

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-18-feat_syntax_add_assignmentoperator_to_logical_operator_and_to_binary_operator_methods
Nov 19, 2024
Merged

feat(syntax): add AssignmentOperator::to_logical_operator and to_binary_operator methods#7350
graphite-app[bot] merged 1 commit intomainfrom
11-18-feat_syntax_add_assignmentoperator_to_logical_operator_and_to_binary_operator_methods

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Nov 18, 2024

Add methods to convert AssignmentOperator to LogicalOperator or BinaryOperator. e.g. += -> +, &&= -> &&.

@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 18, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

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

@github-actions github-actions bot added the C-enhancement Category - New feature or request label Nov 18, 2024
@overlookmotel overlookmotel marked this pull request as ready for review November 18, 2024 22:18
@overlookmotel overlookmotel changed the base branch from 11-18-style_syntax_improve_formatting to graphite-base/7350 November 18, 2024 22:26
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 18, 2024

CodSpeed Performance Report

Merging #7350 will create unknown performance changes

Comparing 11-18-feat_syntax_add_assignmentoperator_to_logical_operator_and_to_binary_operator_methods (2534cde) with main (41a0e60)

Summary

🆕 30 new benchmarks

Benchmarks breakdown

Benchmark main 11-18-feat_syntax_add_assignmentoperator_to_logical_operator_and_to_binary_operator_methods Change
🆕 codegen[checker.ts] N/A 24.6 ms N/A
🆕 codegen_sourcemap[checker.ts] N/A 77.4 ms N/A
🆕 isolated-declarations[vue-id.ts] N/A 397.4 ms N/A
🆕 lexer[RadixUIAdoptionSection.jsx] N/A 24 µs N/A
🆕 lexer[antd.js] N/A 22.3 ms N/A
🆕 lexer[cal.com.tsx] N/A 5.5 ms N/A
🆕 lexer[checker.ts] N/A 13.3 ms N/A
🆕 lexer[pdf.mjs] N/A 3.6 ms N/A
🆕 linter[RadixUIAdoptionSection.jsx] N/A 2.4 ms N/A
🆕 linter[cal.com.tsx] N/A 1.1 s N/A
🆕 linter[checker.ts] N/A 2.6 s N/A
🆕 minifier[antd.js] N/A 437.2 ms N/A
🆕 minifier[react.development.js] N/A 2.9 ms N/A
🆕 minifier[typescript.js] N/A 545.4 ms N/A
🆕 parser[RadixUIAdoptionSection.jsx] N/A 77.7 µs N/A
🆕 parser[antd.js] N/A 106.5 ms N/A
🆕 parser[cal.com.tsx] N/A 24.6 ms N/A
🆕 parser[checker.ts] N/A 53.5 ms N/A
🆕 parser[pdf.mjs] N/A 17.4 ms N/A
🆕 semantic[RadixUIAdoptionSection.jsx] N/A 98.2 µs N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

@overlookmotel overlookmotel force-pushed the 11-18-feat_syntax_add_assignmentoperator_to_logical_operator_and_to_binary_operator_methods branch from 30c3aa8 to 890bdfa Compare November 18, 2024 22:31
@overlookmotel overlookmotel changed the base branch from graphite-base/7350 to main November 18, 2024 22:32
@overlookmotel overlookmotel force-pushed the 11-18-feat_syntax_add_assignmentoperator_to_logical_operator_and_to_binary_operator_methods branch from 890bdfa to 53997c2 Compare November 18, 2024 22:32
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Nov 19, 2024
Copy link
Member

Boshen commented Nov 19, 2024

Merge activity

  • Nov 18, 8:06 PM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Nov 18, 8:07 PM EST: A user added this pull request to the Graphite merge queue.
  • Nov 18, 8:17 PM EST: A user merged this pull request with the Graphite merge queue.

…inary_operator` methods (#7350)

Add methods to convert `AssignmentOperator` to `LogicalOperator` or `BinaryOperator`. e.g. `+=` -> `+`, `&&=` -> `&&`.
@Boshen Boshen force-pushed the 11-18-feat_syntax_add_assignmentoperator_to_logical_operator_and_to_binary_operator_methods branch from 53997c2 to 2534cde Compare November 19, 2024 01:12
Boshen pushed a commit that referenced this pull request Nov 19, 2024
Re-order enum variants of `AssignmentOperator`, `BinaryOperator` and `UnaryOperator`.

* `Exponential` moved to after `Remainder` (so with the rest of the arithmetic operators).
* `Shift*` operators follow arithmetic operators.
* `AssignmentOperator::Bitwise*` ops moved to before `Logical*` ops (so all ops which correspond to `BinaryOperator`s are together).
* `*Or` always before `*And`.
* Plus/Addition always before Minus/Subtraction.

The purpose is to make the various methods on these types maximally efficient:

1. Group together variants so that `AssignmentOperator::is_*` methods can be executed with the minimum number of operations (essentially `variant - min <= max`).
2. Align the variants of `AssignmentOperator` and `BinaryOperator` so that conversion methods added in #7350 become very cheap too (essentially `if variant - min <= max { Some(variant + offset) } else { None }`).
@graphite-app graphite-app bot merged commit 2534cde into main Nov 19, 2024
@graphite-app graphite-app bot deleted the 11-18-feat_syntax_add_assignmentoperator_to_logical_operator_and_to_binary_operator_methods branch November 19, 2024 01:17
Boshen pushed a commit that referenced this pull request Nov 19, 2024
Re-order enum variants of `AssignmentOperator`, `BinaryOperator` and `UnaryOperator`.

* `Exponential` moved to after `Remainder` (so with the rest of the arithmetic operators).
* `Shift*` operators follow arithmetic operators.
* `AssignmentOperator::Bitwise*` ops moved to before `Logical*` ops (so all ops which correspond to `BinaryOperator`s are together).
* `*Or` always before `*And`.
* Plus/Addition always before Minus/Subtraction.

The purpose is to make the various methods on these types maximally efficient:

1. Group together variants so that `AssignmentOperator::is_*` methods can be executed with the minimum number of operations (essentially `variant - min <= max`).
2. Align the variants of `AssignmentOperator` and `BinaryOperator` so that conversion methods added in #7350 become very cheap too (essentially `if variant - min <= max { Some(variant + offset) } else { None }`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-merge Merge with Graphite Merge Queue C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants