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

feat(es/transform): introduce NodeIgnoringSpan #7030

Merged
merged 11 commits into from Mar 8, 2023
Merged

Conversation

hyf0
Copy link
Contributor

@hyf0 hyf0 commented Mar 7, 2023

Description:

  • Introduce NodeIgnoringSpan, which will ignore Span while doing eq or hash.
  • Improve the performance of InlineGlobals.

BREAKING CHANGE:

Related issue (if exists):

@hyf0 hyf0 marked this pull request as draft March 7, 2023 17:52
impl<'a, Node: EqIgnoreSpan + ToOwned + Debug> Eq for NodeIgnoringSpan<'a, Node> {}

// TODO: This only a workaround for Expr. we need something like
// `hash_ignore_span` for each node in the end.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need hash_ignore_span in the end if we want to make this implementation energetic.

And the code could be rewritten like

impl<'a, Node: HashIgnoreSpan> Hash for NodeIgnoringSpan<'a, Node> {
    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
          self.hash_ignore_span(state)
        }
    }
}

However, I think this could be done in another PR.

@kdy1 kdy1 self-assigned this Mar 8, 2023
@hyf0 hyf0 marked this pull request as ready for review March 8, 2023 04:22
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!


swc-bump:

  • swc_ecma_utils

crates/swc_ecma_utils/src/node_ignore_span.rs Outdated Show resolved Hide resolved
@kdy1 kdy1 added this to the Planned milestone Mar 8, 2023
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!


swc-bump:

  • swc_ecma_utils
  • swc_ecma_transforms_optimization --breaking

@kdy1 kdy1 enabled auto-merge (squash) March 8, 2023 06:20
@kdy1 kdy1 disabled auto-merge March 8, 2023 06:20
@kdy1 kdy1 enabled auto-merge (squash) March 8, 2023 06:21
@kdy1 kdy1 merged commit 8bfef35 into swc-project:main Mar 8, 2023
@kdy1 kdy1 modified the milestones: Planned, v1.3.39 Mar 10, 2023
@swc-project swc-project locked as resolved and limited conversation to collaborators Apr 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants