private boolean isResultNumber(BinaryNode binaryNode) { boolean bResult = false; TokenType tokenType = binaryNode.tokenType(); Node lhs = binaryNode.lhs(); Node rhs = binaryNode.rhs(); if ((tokenType == TokenType.BIT_OR || tokenType == TokenType.BIT_AND) && ((lhs instanceof LiteralNode && ((LiteralNode) lhs).isNumeric()) || (rhs instanceof LiteralNode && ((LiteralNode) rhs).isNumeric()))) { bResult = true; } else if (tokenType == TokenType.DIV || tokenType == TokenType.MUL || tokenType == TokenType.SUB ){ bResult = true; } else { if (lhs instanceof BinaryNode) { bResult = isResultNumber((BinaryNode) lhs); } else if (rhs instanceof BinaryNode) { bResult = isResultNumber((BinaryNode) rhs); } } return bResult; }
add(exp, offsetVisitor.findOffset(binaryNode.lhs()), false); reset(); binaryNode.rhs().accept(this); add(exp, offsetVisitor.findOffset(binaryNode.rhs()), false); reset(); return false; if (binaryNode.rhs() instanceof FunctionNode) { binaryNode.lhs().accept(this); return false; binaryNode.rhs().accept(this); return false;
private boolean isResultString(BinaryNode binaryNode) { boolean bResult = false; TokenType tokenType = binaryNode.tokenType(); Node lhs = binaryNode.lhs(); Node rhs = binaryNode.rhs(); if (tokenType == TokenType.ADD && ((lhs instanceof LiteralNode && ((LiteralNode) lhs).isString()) || (rhs instanceof LiteralNode && ((LiteralNode) rhs).isString()))) { bResult = true; } else { if (lhs instanceof JoinPredecessorExpression) { lhs = ((JoinPredecessorExpression)lhs).getExpression(); } if (rhs instanceof JoinPredecessorExpression) { rhs = ((JoinPredecessorExpression)rhs).getExpression(); } if (lhs instanceof BinaryNode) { bResult = isResultString((BinaryNode) lhs); } else if (rhs instanceof BinaryNode) { bResult = isResultString((BinaryNode) rhs); } } return bResult; }
@Override public boolean enterBinaryNode(BinaryNode binaryNode) { Node lhs = binaryNode.lhs(); Node rhs = binaryNode.rhs(); if (lhs instanceof LiteralNode.ArrayLiteralNode && binaryNode.tokenType() == TokenType.ASSIGN) {
} else if (bNode.lhs() instanceof ObjectNode && bNode.rhs().equals(objectNode)) {
BinaryNode bNode = (BinaryNode) init; if (bNode.isLogical() && ((bNode.rhs() instanceof JoinPredecessorExpression && ((JoinPredecessorExpression) bNode.rhs()).getExpression() instanceof FunctionNode) || (bNode.lhs() instanceof JoinPredecessorExpression && ((JoinPredecessorExpression) bNode.lhs()).getExpression() instanceof FunctionNode))) { createVariable = false; if (parentFn.getProperty(varNode.getName().getName()) == null) { while (bNode.rhs() instanceof BinaryNode && bNode.rhs().isAssignment()) { bNode = (BinaryNode) bNode.rhs(); if (bNode.rhs() instanceof FunctionNode) { FunctionNode fNode = (FunctionNode) bNode.rhs(); JsObject original = parentFn.getProperty(modelBuilder.getFunctionName(fNode)); if (original != null) {
@Override public Node leaveBinaryNode(BinaryNode binaryNode) { Node lhs = binaryNode.lhs(); Node rhs = binaryNode.rhs(); if (lhs instanceof IdentNode && rhs instanceof BinaryNode) { Node rlhs = ((BinaryNode)rhs).lhs(); if (rlhs instanceof IdentNode) { JsObject origFunction = modelBuilder.getCurrentDeclarationFunction().getProperty(((IdentNode)rlhs).getName()); if (origFunction != null && origFunction.getJSKind().isFunction()) { JsObject refFunction = modelBuilder.getCurrentDeclarationFunction().getProperty(((IdentNode)lhs).getName()); if (refFunction != null && !refFunction.getJSKind().isFunction()) { JsFunctionReference newReference = new JsFunctionReference(refFunction.getParent(), refFunction.getDeclarationName(), (JsFunction)origFunction, true, origFunction.getModifiers()); refFunction.getParent().addProperty(newReference.getName(), newReference); } } } } return super.leaveBinaryNode(binaryNode); }