Example usage for org.eclipse.jdt.internal.compiler.lookup TypeBinding FLOAT

List of usage examples for org.eclipse.jdt.internal.compiler.lookup TypeBinding FLOAT

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup TypeBinding FLOAT.

Prototype

BaseTypeBinding FLOAT

To view the source code for org.eclipse.jdt.internal.compiler.lookup TypeBinding FLOAT.

Click Source Link

Usage

From source file:org.eclipse.jdt.internal.compiler.lookup.Scope.java

License:Open Source License

public static TypeBinding getBaseType(char[] name) {
    // list should be optimized (with most often used first)
    int length = name.length;
    if (length > 2 && length < 8) {
        switch (name[0]) {
        case 'i':
            if (length == 3 && name[1] == 'n' && name[2] == 't')
                return TypeBinding.INT;
            break;
        case 'v':
            if (length == 4 && name[1] == 'o' && name[2] == 'i' && name[3] == 'd')
                return TypeBinding.VOID;
            break;
        case 'b':
            if (length == 7 && name[1] == 'o' && name[2] == 'o' && name[3] == 'l' && name[4] == 'e'
                    && name[5] == 'a' && name[6] == 'n')
                return TypeBinding.BOOLEAN;
            if (length == 4 && name[1] == 'y' && name[2] == 't' && name[3] == 'e')
                return TypeBinding.BYTE;
            break;
        case 'c':
            if (length == 4 && name[1] == 'h' && name[2] == 'a' && name[3] == 'r')
                return TypeBinding.CHAR;
            break;
        case 'd':
            if (length == 6 && name[1] == 'o' && name[2] == 'u' && name[3] == 'b' && name[4] == 'l'
                    && name[5] == 'e')
                return TypeBinding.DOUBLE;
            break;
        case 'f':
            if (length == 5 && name[1] == 'l' && name[2] == 'o' && name[3] == 'a' && name[4] == 't')
                return TypeBinding.FLOAT;
            break;
        case 'l':
            if (length == 4 && name[1] == 'o' && name[2] == 'n' && name[3] == 'g')
                return TypeBinding.LONG;
            break;
        case 's':
            if (length == 5 && name[1] == 'h' && name[2] == 'o' && name[3] == 'r' && name[4] == 't')
                return TypeBinding.SHORT;
        }/*  w  w w . j av  a  2 s  . c  o m*/
    }
    return null;
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.WordValueAttribute.java

License:Open Source License

/** can only transfer some flags once we have the method binding */
public boolean evaluate(MethodInfo info, MethodBinding method, LookupEnvironment environment) {
    if (this._methodInfo != info)
        return false;
    // MODIFIERS and ROLECLASS_METHOD_MODIFIERS_NAME and CALLS_BASE_CTOR are already evaluated at the MethodInfo level.
    if (CharOperation.equals(this._name, IOTConstants.CALLIN_FLAGS)) {
        MethodModel.getModel(method).callinFlags = this._value & 0xFF;
        int typeCode = this._value & IOTConstants.CALLIN_RETURN_MASK;
        if (typeCode != 0) {
            TypeBinding returnType;//from  www  .  j a va2 s . c  om
            switch (typeCode) {
            case IOTConstants.CALLIN_RETURN_VOID:
                returnType = TypeBinding.VOID;
                break;
            case IOTConstants.CALLIN_RETURN_BOOLEAN:
                returnType = TypeBinding.BOOLEAN;
                break;
            case IOTConstants.CALLIN_RETURN_BYTE:
                returnType = TypeBinding.BYTE;
                break;
            case IOTConstants.CALLIN_RETURN_CHAR:
                returnType = TypeBinding.CHAR;
                break;
            case IOTConstants.CALLIN_RETURN_SHORT:
                returnType = TypeBinding.SHORT;
                break;
            case IOTConstants.CALLIN_RETURN_DOUBLE:
                returnType = TypeBinding.DOUBLE;
                break;
            case IOTConstants.CALLIN_RETURN_FLOAT:
                returnType = TypeBinding.FLOAT;
                break;
            case IOTConstants.CALLIN_RETURN_INT:
                returnType = TypeBinding.INT;
                break;
            case IOTConstants.CALLIN_RETURN_LONG:
                returnType = TypeBinding.LONG;
                break;
            default:
                throw new InternalCompilerError("Unexpected callin return type code " + typeCode); //$NON-NLS-1$
            }
            MethodModel.saveReturnType(method, returnType);
        }
        return true;
    }
    return false; // not handled, keep it.
}