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(ast-tools): generalize strict_if into flags_if #6591

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DonIsaac
Copy link
Collaborator

No description provided.

Copy link

graphite-app bot commented Oct 15, 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 A-ast Area - AST A-ast-tools Area - AST tools C-enhancement Category - New feature or request labels Oct 15, 2024
Copy link
Collaborator Author

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

Join @DonIsaac and the rest of your teammates on Graphite Graphite

@DonIsaac DonIsaac force-pushed the don/10-14-feat_ast-tools_generalize_strict_if_into_flags_if branch from 0199d97 to 9ed0507 Compare October 15, 2024 15:35
tasks/minsize/minsize.snap Outdated Show resolved Hide resolved
@overlookmotel
Copy link
Collaborator

overlookmotel commented Oct 15, 2024

Sorry to say, I'm not keen on this. I think strict_if(self.is_strict()) is much clearer than flags_if(ScopeFlags::StrictMode, self.is_strict()).

Additionally, what flags_if does is unclear unless you delve into the implementation. e.g. this:

#[scope(
    flags(ScopeFlags::TsModuleBlock),
    flags_if(ScopeFlags::Ambient, self.declare),
)]

Does it mean:

  1. If self.declare is true, flags are ScopeFlags::Ambient? or
  2. If self.declare is true, flags are ScopeFlags::TsModuleBlock | ScopeFlags::Ambient?

If the motivation is #6592, could you not do this instead?

#[scope(
    flags(ScopeFlags::TsModuleBlock.with_ambient(self.declare))
)]

Copy link

codspeed-hq bot commented Oct 15, 2024

CodSpeed Performance Report

Merging #6591 will not alter performance

Comparing don/10-14-feat_ast-tools_generalize_strict_if_into_flags_if (4dbfaf9) with main (7a028b3)

Summary

✅ 30 untouched benchmarks

@DonIsaac DonIsaac force-pushed the don/10-14-feat_ast-tools_generalize_strict_if_into_flags_if branch from 9ed0507 to 4dbfaf9 Compare October 15, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ast Area - AST A-ast-tools Area - AST tools C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants