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: add compatibility for typst_syntax::LinkedNode.leaf_at #582

Merged
merged 3 commits into from
Sep 8, 2024

Conversation

ParaN3xus
Copy link
Contributor

Add compatibility for typst_syntax::LinkedNode.leaf_at

Copy link
Collaborator

@Enter-tainer Enter-tainer left a comment

Choose a reason for hiding this comment

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

LGTM

@Myriad-Dreamin
Copy link
Owner

Please don't use macro but use function instead whenever possible, because macros are not safely typed. For other code, also LGTM.

@Myriad-Dreamin
Copy link
Owner

Note we can apply some tricks to do better than provide functions. we can implement a LinkedNodeExt trait.

trait LinkedNodeExt {
  fn leaf_at_compat(&self, ...);
}

and usage:

use LinkedNodeExt;
let node = root.leaf_at_compat(pos + 1).unwrap();

@Myriad-Dreamin Myriad-Dreamin merged commit ce107ef into Myriad-Dreamin:main Sep 8, 2024
12 checks passed
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.

3 participants