Java Code Examples for jdk.nashorn.internal.ir.Symbol#canBePrimitive()

The following examples show how to use jdk.nashorn.internal.ir.Symbol#canBePrimitive() . 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: MapCreator.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compute property flags given local state of a field. May be overridden and extended,
 *
 * @param symbol       symbol to check
 * @param hasArguments does the created object have an "arguments" property
 *
 * @return flags to use for fields
 */
protected int getPropertyFlags(final Symbol symbol, final boolean hasArguments) {
    int flags = 0;

    if (symbol.isParam()) {
        flags |= Property.IS_ALWAYS_OBJECT | Property.IS_PARAMETER;
    }

    if (hasArguments) {
        flags |= Property.IS_ALWAYS_OBJECT | Property.HAS_ARGUMENTS;
    }

    if (symbol.isScope()) {
        flags |= Property.NOT_CONFIGURABLE;
    }

    if (symbol.canBePrimitive()) {
        flags |= Property.CAN_BE_PRIMITIVE;
    }

    if (symbol.canBeUndefined()) {
        flags |= Property.CAN_BE_UNDEFINED;
    }

    return flags;
}
 
Example 2
Source File: MapCreator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compute property flags given local state of a field. May be overridden and extended,
 *
 * @param symbol       symbol to check
 * @param hasArguments does the created object have an "arguments" property
 *
 * @return flags to use for fields
 */
protected int getPropertyFlags(final Symbol symbol, final boolean hasArguments) {
    int flags = 0;

    if (symbol.isParam()) {
        flags |= Property.IS_ALWAYS_OBJECT | Property.IS_PARAMETER;
    }

    if (hasArguments) {
        flags |= Property.IS_ALWAYS_OBJECT | Property.HAS_ARGUMENTS;
    }

    if (symbol.isScope()) {
        flags |= Property.NOT_CONFIGURABLE;
    }

    if (symbol.canBePrimitive()) {
        flags |= Property.CAN_BE_PRIMITIVE;
    }

    if (symbol.canBeUndefined()) {
        flags |= Property.CAN_BE_UNDEFINED;
    }

    if (symbol.isFunctionDeclaration()) {
        flags |= Property.IS_FUNCTION_DECLARATION;
    }

    return flags;
}
 
Example 3
Source File: MapCreator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compute property flags given local state of a field. May be overridden and extended,
 *
 * @param symbol       symbol to check
 * @param hasArguments does the created object have an "arguments" property
 *
 * @return flags to use for fields
 */
protected int getPropertyFlags(final Symbol symbol, final boolean hasArguments) {
    int flags = 0;

    if (symbol.isParam()) {
        flags |= Property.IS_ALWAYS_OBJECT | Property.IS_PARAMETER;
    }

    if (hasArguments) {
        flags |= Property.IS_ALWAYS_OBJECT | Property.HAS_ARGUMENTS;
    }

    if (symbol.isScope()) {
        flags |= Property.NOT_CONFIGURABLE;
    }

    if (symbol.canBePrimitive()) {
        flags |= Property.CAN_BE_PRIMITIVE;
    }

    if (symbol.canBeUndefined()) {
        flags |= Property.CAN_BE_UNDEFINED;
    }

    if (symbol.isFunctionDeclaration()) {
        flags |= Property.IS_FUNCTION_DECLARATION;
    }

    return flags;
}