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

Unconditionally terminated loop #1542

Open
someone235 opened this issue Feb 18, 2020 · 0 comments
Open

Unconditionally terminated loop #1542

someone235 opened this issue Feb 18, 2020 · 0 comments

Comments

@someone235
Copy link

Hi, this looks like a bug.

	// When there is no left node walk the parents until the parent's left
	// node is not equal to the previous child.  This will be the previous
	// node.
	for iter.node.left == nil {
		parent := iter.parents.Pop()
		for parent != nil && parent.left == iter.node {
			iter.node = parent
			parent = iter.parents.Pop()
		}
		iter.node = parent
		return iter.limitIterator()
	}

I guess you want to do something like this

	// When there is no left node walk the parents until the parent's left
	// node is not equal to the previous child.  This will be the previous
	// node.
	if  iter.node.left == nil {
		for iter.node.left == nil {
			parent := iter.parents.Pop()
			for parent != nil && parent.left == iter.node {
				iter.node = parent
				parent = iter.parents.Pop()
			}
			iter.node = parent
		}
		return iter.limitIterator()
	}

Am I correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants