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

JSON transform has an error branch condition #50

Open
wss534857356 opened this issue Aug 28, 2023 · 0 comments
Open

JSON transform has an error branch condition #50

wss534857356 opened this issue Aug 28, 2023 · 0 comments

Comments

@wss534857356
Copy link

wss534857356 commented Aug 28, 2023

else if (to === otherFrom) c.lm--;

seems to have a wrong branch condition.First, it needs to be judged at the top layer that otherTo is not equal to otherFrom:

if (otherFrom !== otherTo) {
          // if otherFrom == otherTo, we don't need to change our op.

and then judge that to must be equal to otherTo, and to must be equal to otherFrom,

...
            } else if (to === otherTo) {
              // if we're both moving in the same direction, tie break
              if ((otherTo > otherFrom && to > from) ||
                  (otherTo < otherFrom && to < from)) {
                if (type === 'right') c.lm++;
              } else {
                if (to > from) c.lm++;
                else if (to === otherFrom) c.lm--;
              }
            }
...
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

No branches or pull requests

1 participant