Java Code Examples for jdk.nashorn.internal.codegen.types.Type#areEquivalent()

The following examples show how to use jdk.nashorn.internal.codegen.types.Type#areEquivalent() . 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: RuntimeCallSite.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean equals(final Object other) {
    if (other instanceof SpecializedRuntimeNode) {
        final SpecializedRuntimeNode otherNode = (SpecializedRuntimeNode)other;

        if (!otherNode.getReturnType().equals(getReturnType())) {
            return false;
        }

        if (getParameterTypes().length != otherNode.getParameterTypes().length) {
            return false;
        }

        for (int i = 0; i < getParameterTypes().length; i++) {
            if (!Type.areEquivalent(getParameterTypes()[i], otherNode.getParameterTypes()[i])) {
                return false;
            }
        }

        return otherNode.getRequest().equals(getRequest());
    }

    return false;
}
 
Example 2
Source File: RuntimeCallSite.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean equals(final Object other) {
    if (other instanceof SpecializedRuntimeNode) {
        final SpecializedRuntimeNode otherNode = (SpecializedRuntimeNode)other;

        if (!otherNode.getReturnType().equals(getReturnType())) {
            return false;
        }

        if (getParameterTypes().length != otherNode.getParameterTypes().length) {
            return false;
        }

        for (int i = 0; i < getParameterTypes().length; i++) {
            if (!Type.areEquivalent(getParameterTypes()[i], otherNode.getParameterTypes()[i])) {
                return false;
            }
        }

        return otherNode.getRequest().equals(getRequest());
    }

    return false;
}
 
Example 3
Source File: RuntimeCallSite.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean equals(final Object other) {
    if (other instanceof SpecializedRuntimeNode) {
        final SpecializedRuntimeNode otherNode = (SpecializedRuntimeNode)other;

        if (!otherNode.getReturnType().equals(getReturnType())) {
            return false;
        }

        if (getParameterTypes().length != otherNode.getParameterTypes().length) {
            return false;
        }

        for (int i = 0; i < getParameterTypes().length; i++) {
            if (!Type.areEquivalent(getParameterTypes()[i], otherNode.getParameterTypes()[i])) {
                return false;
            }
        }

        return otherNode.getRequest().equals(getRequest());
    }

    return false;
}
 
Example 4
Source File: IdentNode.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public IdentNode setType(final TemporarySymbols ts, final LexicalContext lc, final Type type) {
    // do NOT, repeat NOT touch the symbol here. it might be a local variable or whatever. This is the override if it isn't
    if (this.callSiteType == type) {
        return this;
    }
    if (DEBUG_FIELDS && getSymbol() != null && !Type.areEquivalent(getSymbol().getSymbolType(), type)) {
        ObjectClassGenerator.LOG.info(getClass().getName(), " ", this, " => ", type, " instead of ", getType());
    }

    return new IdentNode(this, name, type, flags);
}
 
Example 5
Source File: BaseNode.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Debug type change
 * @param type new type
 */
protected final void logTypeChange(final Type type) {
    if (DEBUG_FIELDS && !Type.areEquivalent(getSymbol().getSymbolType(), type)) {
        ObjectClassGenerator.LOG.info(getClass().getName(), " ", this, " => ", type, " instead of ", getType());
    }
}