Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

fix a bug where oldNode was null on every step #79

Merged
merged 1 commit into from
Jan 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions lib/node/Status.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ class Status {
hasChanged() {
return this.changeType !== ChangeTypes.NO_CHANGE;
}

reset() {
this.oldNode = null;
// clone so that the next step's oldNode doesn't modify this step's newNode
this.newNode = Status.resetChangeGroups(this.newNode);
}
}

Status.resetChangeGroups = function(node) {
Expand Down
5 changes: 3 additions & 2 deletions lib/simplifyExpression/stepThrough.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const checks = require('../checks');
const Node = require('../node');
const Status = require('../node/Status');

const arithmeticSearch = require('./arithmeticSearch');
const basicsSearch = require('./basicsSearch');
Expand Down Expand Up @@ -44,8 +45,8 @@ function stepThrough(node, debug=false) {
logSteps(nodeStatus);
}
steps.push(removeUnnecessaryParensInStep(nodeStatus));
nodeStatus.reset();
nodeStatus = step(nodeStatus.newNode);
const nextNode = Status.resetChangeGroups(nodeStatus.newNode);
Copy link
Contributor

Choose a reason for hiding this comment

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

merge your change to run tests+linter before committing ;D

you need to import Status here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops

Copy link
Contributor

Choose a reason for hiding this comment

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

np :) lemme know when it's ready!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be now! I had forgotten to push yesterday...

nodeStatus = step(nextNode);
if (iters++ === MAX_STEP_COUNT) {
// eslint-disable-next-line
console.error('Math error: Potential infinite loop for expression: ' +
Expand Down