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

transformations: Add further csl name hints #3399

Merged
merged 7 commits into from
Nov 5, 2024

Conversation

n-io
Copy link
Collaborator

@n-io n-io commented Nov 4, 2024

No description provided.

@n-io n-io added the minor For minor PRs, easy and quick to review, quickly mergeable label Nov 4, 2024
@n-io n-io self-assigned this Nov 4, 2024
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.15%. Comparing base (9cbeec8) to head (0c003f5).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3399      +/-   ##
==========================================
- Coverage   90.15%   90.15%   -0.01%     
==========================================
  Files         453      455       +2     
  Lines       57220    57373     +153     
  Branches     5502     5524      +22     
==========================================
+ Hits        51588    51724     +136     
- Misses       4176     4193      +17     
  Partials     1456     1456              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 323 to 327
import_.result.name_hint = self._get_name_hint(op)

rewriter.insert_op(ops, InsertPoint.at_start(csl_mod.body.block))
rewriter.replace_matched_op([*structs, import_])
rewriter.insert_op(structs, InsertPoint.before(op))
rewriter.replace_matched_op(import_)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is to prevent the structs from having the same name as the buffer, and the buffer turning into buf_8 for instance, which may be confusing.

@n-io n-io requested a review from dk949 November 5, 2024 14:40
Copy link
Collaborator

@dk949 dk949 left a comment

Choose a reason for hiding this comment

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

I've got a comment, but I'm not 100% it's correct

@@ -303,6 +306,12 @@ def _make_import_struct(self, import_op: csl_wrapper.ImportOp):
out_structs.append(csl.ConcatStructOp(out_structs[-1], s))
return out_structs

def _get_name_hint(self, import_op: csl_wrapper.ImportOp) -> str | None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this be Path(import_op.module.data.strip("<>" )).stem?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes!

@n-io n-io merged commit 5da852f into main Nov 5, 2024
14 checks passed
@n-io n-io deleted the nicolai/csl-further-name-hints branch November 5, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor For minor PRs, easy and quick to review, quickly mergeable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants