jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode.ArrayUnit Java Examples

The following examples show how to use jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode.ArrayUnit. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReplaceCompileUnits.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #2
Source File: AssignSymbols.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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());
}
 
Example #3
Source File: WeighNodes.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #4
Source File: WeighNodes.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #5
Source File: WeighNodes.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #6
Source File: WeighNodes.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
@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;
}