@Override public Node leaveLiteralNode(final LiteralNode<?> node) { if (node instanceof ArrayLiteralNode) { final ArrayLiteralNode aln = (ArrayLiteralNode)node; if (aln.getUnits() == null) { return node; } final List<ArrayUnit> newArrayUnits = new ArrayList<>(); for (final ArrayUnit au : aln.getUnits()) { newArrayUnits.add(new ArrayUnit(getExistingReplacement(au), au.getLo(), au.getHi())); } return aln.setUnits(lc, newArrayUnits); } return node; }
private static boolean isSplitArray(final LexicalContextNode expr) { if(!(expr instanceof ArrayLiteralNode)) { return false; } final List<ArrayUnit> units = ((ArrayLiteralNode)expr).getUnits(); return !(units == null || units.isEmpty()); }
@SuppressWarnings("rawtypes") @Override public boolean enterLiteralNode(final LiteralNode literalNode) { weight += LITERAL_WEIGHT; if (literalNode instanceof ArrayLiteralNode) { final ArrayLiteralNode arrayLiteralNode = (ArrayLiteralNode)literalNode; final Node[] value = arrayLiteralNode.getValue(); final int[] postsets = arrayLiteralNode.getPostsets(); final List<ArrayUnit> units = arrayLiteralNode.getUnits(); if (units == null) { for (final int postset : postsets) { weight += AASTORE_WEIGHT; final Node element = value[postset]; if (element != null) { element.accept(this); } } } return false; } return true; }