Skip to content

Commit

Permalink
Fix conditional case, issue #13
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan-Lyashenko committed Nov 20, 2017
1 parent 004afe4 commit 6029c66
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions dist/js2flowchart.js
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,8 @@ var TOKEN_KEYS = exports.TOKEN_KEYS = {
BODY: 'body',
PROGRAM: 'program',
CONSEQUENT: 'consequent',
ALTERNATE: 'alternate'
ALTERNATE: 'alternate',
TEST: 'test'
};

var ARROW_TYPE = exports.ARROW_TYPE = {
Expand Down Expand Up @@ -4292,7 +4293,8 @@ var DefinitionsMap = exports.DefinitionsMap = (_DefinitionsMap = {}, _defineProp
getName: _core.assignmentExpressionConverter,
ignore: function ignore(path) {
var statementParent = path.getStatementParent();
return statementParent.isVariableDeclaration() || statementParent.isConditional() || (0, _core.isNodeContainsFunc)(path.node.right);

return statementParent.isVariableDeclaration() || path.parent.type === _constants.TOKEN_TYPES.LOGICAL_EXPRESSION || statementParent.isConditional() && path.key === _constants.TOKEN_KEYS.TEST || (0, _core.isNodeContainsFunc)(path.node.right);
}
}), _defineProperty(_DefinitionsMap, _constants.TOKEN_TYPES.CALL_EXPRESSION, {
type: _constants.TOKEN_TYPES.CALL_EXPRESSION,
Expand Down
2 changes: 1 addition & 1 deletion dist/js2flowchart.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "js2flowchart",
"version": "1.0.3",
"version": "1.0.4",
"author": "Bohdan Liashenko",
"license": "MIT",
"repository": {
Expand Down
5 changes: 4 additions & 1 deletion src/builder/entryDefinitionsMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ export const DefinitionsMap = {
getName: assignmentExpressionConverter,
ignore: path => {
const statementParent = path.getStatementParent();
return statementParent.isVariableDeclaration() || statementParent.isConditional() ||

return statementParent.isVariableDeclaration() ||
path.parent.type === TOKEN_TYPES.LOGICAL_EXPRESSION ||
(statementParent.isConditional() && path.key === TOKEN_KEYS.TEST) ||
isNodeContainsFunc(path.node.right);
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/shared/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export const TOKEN_KEYS = {
BODY: 'body',
PROGRAM: 'program',
CONSEQUENT: 'consequent',
ALTERNATE: 'alternate'
ALTERNATE: 'alternate',
TEST: 'test'
};

export const ARROW_TYPE = {
Expand Down

0 comments on commit 6029c66

Please sign in to comment.