We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The method isCoalesce of BranchHelper class could be enhanced like that:
public boolean isCoalesce(AstNode node) { return node.getType() == Token.OR && (node.getParent().getType() == Token.ASSIGN || node.getParent().getType() == Token.VAR || node.getParent().getType() == Token.RETURN); }
The text was updated successfully, but these errors were encountered:
Sure, so with this test case added to BranchHelperTest
BranchHelperTest
@Test public void shouldDetectCoalesceOnReturn() { String script = "function f(y) {return y || {};}"; AstRoot astRoot = parser.parse(script, null, 1); AstNode orNode = NodeTestHelper.findNode(astRoot, Token.OR); assertThat(helper.isCoalesce(orNode), is(true)); }
Sorry, something went wrong.
Fix isCoalesce for return statements (#219)
ed3e359
Works like a charm.
tntim96
No branches or pull requests
The method isCoalesce of BranchHelper class could be enhanced like that:
The text was updated successfully, but these errors were encountered: