/** * Check if the node is for {@code super(this)} but not * {@code super(this).call()}. The incoming tree shape is: * * <pre> * MemberAccessExpressionID(FunctionCallID(SuperID(void), ContainerID(IdentifierID(void))), qname) * </pre> * * @return "0" if the node represents {@code super(this)}; * {@link Integer#MAX_VALUE} otherwise. */ public static int isSuperThisForFieldAccess(IASNode n) { // super(this).callSomething() is handled by another pattern that emits // "callsuper" instruction. if (n.getParent() instanceof FunctionCallNode) return Integer.MAX_VALUE; // The following unguarded casts are safe, because this is a cost // function and the pattern matcher has checked all the node IDs. final MemberAccessExpressionNode memberAccessNode = (MemberAccessExpressionNode)n; final FunctionCallNode callNode = (FunctionCallNode)memberAccessNode.getLeftOperandNode(); final IdentifierNode idNode = (IdentifierNode)callNode.getArgumentsNode().getChild(0); if (idNode.getName().equals(IASKeywordConstants.THIS)) return 1; else return Integer.MAX_VALUE; }
/** * Check if the node is for {@code super(this)} but not * {@code super(this).call()}. The incoming tree shape is: * * <pre> * MemberAccessExpressionID(FunctionCallID(SuperID(void), ContainerID(IdentifierID(void))), qname) * </pre> * * @return "0" if the node represents {@code super(this)}; * {@link Integer#MAX_VALUE} otherwise. */ public static int isSuperThisForFieldAccess(IASNode n) { // super(this).callSomething() is handled by another pattern that emits // "callsuper" instruction. if (n.getParent() instanceof FunctionCallNode) return Integer.MAX_VALUE; // The following unguarded casts are safe, because this is a cost // function and the pattern matcher has checked all the node IDs. final MemberAccessExpressionNode memberAccessNode = (MemberAccessExpressionNode)n; final FunctionCallNode callNode = (FunctionCallNode)memberAccessNode.getLeftOperandNode(); final IdentifierNode idNode = (IdentifierNode)callNode.getArgumentsNode().getChild(0); if (idNode.getName().equals(IASKeywordConstants.THIS)) return 1; else return Integer.MAX_VALUE; }
if (left instanceof FunctionCallNode) // probably a cast IASNode child = ((FunctionCallNode)left).getArgumentsNode().getChild(0); if (child instanceof IdentifierNode) s = getSourceStringFromIdentifierNode((IdentifierNode)child); if (right instanceof FunctionCallNode) // probably a cast IASNode child = ((FunctionCallNode)right).getArgumentsNode().getChild(0); if (child instanceof IdentifierNode) s += getSourceStringFromIdentifierNode((IdentifierNode)child);
if (left instanceof FunctionCallNode) // probably a cast IASNode child = ((FunctionCallNode)left).getArgumentsNode().getChild(0); if (child instanceof IdentifierNode) s = getSourceStringFromIdentifierNode((IdentifierNode)child); if (right instanceof FunctionCallNode) // probably a cast IASNode child = ((FunctionCallNode)right).getArgumentsNode().getChild(0); if (child instanceof IdentifierNode) s += getSourceStringFromIdentifierNode((IdentifierNode)child);
if (left instanceof FunctionCallNode) // probably a cast IASNode child = ((FunctionCallNode)left).getArgumentsNode().getChild(0); if (child instanceof IdentifierNode) s = getSourceStringFromIdentifierNode((IdentifierNode)child); if (right instanceof FunctionCallNode) // probably a cast IASNode child = ((FunctionCallNode)right).getArgumentsNode().getChild(0); if (child instanceof IdentifierNode) s += getSourceStringFromIdentifierNode((IdentifierNode)child);
actuals_container = ((FunctionCallNode)iNode).getArgumentsNode();
actuals_container = ((FunctionCallNode)iNode).getArgumentsNode();
((FunctionCallNode)n).isNewExpression(); final boolean newFunctionCallAlreadyHasArgs = isNewExpression && ((FunctionCallNode)n).getArgumentsNode().getStart() != -1; oldNode.setNewKeywordNode(null); args = ((FunctionCallNode)n).getArgumentsNode(); args.startBefore(lpT); args.endAfter(lpT);
((FunctionCallNode)n).isNewExpression(); final boolean newFunctionCallAlreadyHasArgs = isNewExpression && ((FunctionCallNode)n).getArgumentsNode().getStart() != -1; oldNode.setNewKeywordNode(null); args = ((FunctionCallNode)n).getArgumentsNode(); args.startBefore(lpT); args.endAfter(lpT);
FunctionCallNode newBytes = new FunctionCallNode(newToken, new IdentifierNode(byteArrayClassName)); FunctionCallNode byteArrayCall = new FunctionCallNode(new IdentifierNode("ByteArray")); ContainerNode args = byteArrayCall.getArgumentsNode(); args.addItem(newBytes); BinaryOperatorNodeBase assignmentBytes = BinaryOperatorNodeBase.create(assignToken, new IdentifierNode("bytes"), byteArrayCall);
FunctionCallNode newBytes = new FunctionCallNode(newToken, new IdentifierNode(byteArrayClassName)); FunctionCallNode byteArrayCall = new FunctionCallNode(new IdentifierNode("ByteArray")); ContainerNode args = byteArrayCall.getArgumentsNode(); args.addItem(newBytes); BinaryOperatorNodeBase assignmentBytes = BinaryOperatorNodeBase.create(assignToken, new IdentifierNode("bytes"), byteArrayCall);