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

refactor: unify the logic of span_to_location into trait SourcePosition #8640

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

Conversation

shulaoda
Copy link
Collaborator

@shulaoda shulaoda commented Dec 7, 2024

Summary

I have unified this logic into dependency_location.rs.

// Todo(shulaoda): check if this can be removed
fn span_to_location(span: Span, source: &str) -> Option<String> {

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@shulaoda shulaoda requested a review from h-a-n-a December 7, 2024 07:16
Copy link

netlify bot commented Dec 7, 2024

Deploy Preview for rspack canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 9ca53fa
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/6754081044661900088620d4

Comment on lines +184 to +185
impl SourceLocation for &str {
fn look_up_range_pos(&self, start: u32, end: u32) -> Option<(SourcePosition, SourcePosition)> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can't implement that method for dyn rspack_sources::Source. Perhaps we should implement a lookup_char_pos method on the Source trait, similar to the one in swc_core::common::SourceMap.

@shulaoda shulaoda marked this pull request as draft December 7, 2024 07:45
@shulaoda shulaoda force-pushed the refactor/remove-unnecessary-location-transform branch from 11f668d to 7a1ea2e Compare December 7, 2024 07:45
@shulaoda shulaoda changed the title refactor: remove unnecessary function span_to_location refactor: unify the logic of span_to_location into trait SourcePosition Dec 7, 2024
@shulaoda shulaoda force-pushed the refactor/remove-unnecessary-location-transform branch from 7a1ea2e to 04f82d8 Compare December 7, 2024 07:51
@shulaoda shulaoda force-pushed the refactor/remove-unnecessary-location-transform branch from 04f82d8 to 9ca53fa Compare December 7, 2024 08:32
@shulaoda shulaoda marked this pull request as ready for review December 7, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant