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: change Node pointers to values #21

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

Conversation

topi314
Copy link
Contributor

@topi314 topi314 commented Nov 10, 2024

This changes the method receivers of the Node type to values instead of pointers for non mutating methods & pointer return type as discussed in #19 (comment)

@topi314 topi314 marked this pull request as draft November 10, 2024 02:41
@topi314 topi314 force-pushed the refactor/node-value-receivers branch from b4b762c to 0e66c09 Compare November 10, 2024 11:35
@@ -713,7 +713,7 @@ func (qc *QueryCursor) DidExceedMatchLimit() bool {
// captures. Because multiple patterns can match the same set of nodes,
// one match may contain captures that appear *before* some of the
// captures from a previous match.
func (qc *QueryCursor) Matches(query *Query, node *Node, text []byte) QueryMatches {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am unsure if you also intended me to change this

@@ -737,7 +737,7 @@ func (qc *QueryCursor) Matches(query *Query, node *Node, text []byte) QueryMatch
//
// This is useful if you don't care about which pattern matched, and just
// want a single, ordered sequence of captures.
func (qc *QueryCursor) Captures(query *Query, node *Node, text []byte) QueryCaptures {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am unsure if you also intended me to change this

Comment on lines -31 to +32
func (t *Tree) RootNodeWithOffset(offsetBytes int, offsetExtent Point) *Node {
return &Node{_inner: C.ts_tree_root_node_with_offset(t._inner, C.uint(offsetBytes), offsetExtent.toTSPoint())}
func (t *Tree) RootNodeWithOffset(offsetBytes int, offsetExtent Point) Node {
return Node{_inner: C.ts_tree_root_node_with_offset(t._inner, C.uint(offsetBytes), offsetExtent.toTSPoint())}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am unsure if you also intended me to change this

Comment on lines -25 to +26
func (t *Tree) RootNode() *Node {
return &Node{_inner: C.ts_tree_root_node(t._inner)}
func (t *Tree) RootNode() Node {
return Node{_inner: C.ts_tree_root_node(t._inner)}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am unsure if you also intended me to change this

@topi314 topi314 marked this pull request as ready for review November 10, 2024 11:39
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