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

Revive emit_debug_print #84

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Conversation

frank-emrich
Copy link

This is a simpler alternative to #82 that does not implement a bespoke pattern matcher, but uses two calls to str's match_indices function.

Comment on lines +258 to +260
.match_indices("{}")
.chain(s.match_indices("{:p}"))
.collect();
Copy link
Member

Choose a reason for hiding this comment

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

Does this yield the expected behaviour for a string like "{:p}{}"? Reading the code it seems like {} will be printed first.

Copy link
Author

Choose a reason for hiding this comment

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

After this line, ph_matches would indeed contain the entry for "{}" before that of "{:p}". That's why the next line sorts the matches based on the first value of the tuple (i.e., the start index of the match).

@dhil dhil merged commit bd81f03 into wasmfx:main Jan 29, 2024
18 checks passed
@frank-emrich frank-emrich deleted the revive-emit_debug_print branch January 29, 2024 12:34
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.

2 participants