Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg#NEED_LITERAL_ERR

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg#NEED_LITERAL_ERR . 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: CastCall.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Type check the two parameters for this function
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    // Check that the function was passed exactly two arguments
    if (argumentCount() != 2) {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
                                              getName(), this));
    }

    // The first argument must be a literal String
    Expression exp = argument(0);
    if (exp instanceof LiteralExpr) {
        _className = ((LiteralExpr) exp).getValue();
        _type = Type.newObjectType(_className);
    }
    else {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                              getName(), this));
    }

     // Second argument must be of type reference or object
    _right = argument(1);
    Type tright = _right.typeCheck(stable);
    if (tright != Type.Reference &&
        tright instanceof ObjectType == false)
    {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                              tright, _type, this));
    }

    return _type;
}
 
Example 2
Source File: CastCall.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Type check the two parameters for this function
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    // Check that the function was passed exactly two arguments
    if (argumentCount() != 2) {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
                                              getName(), this));
    }

    // The first argument must be a literal String
    Expression exp = argument(0);
    if (exp instanceof LiteralExpr) {
        _className = ((LiteralExpr) exp).getValue();
        _type = Type.newObjectType(_className);
    }
    else {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                              getName(), this));
    }

     // Second argument must be of type reference or object
    _right = argument(1);
    Type tright = _right.typeCheck(stable);
    if (tright != Type.Reference &&
        tright instanceof ObjectType == false)
    {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                              tright, _type, this));
    }

    return _type;
}
 
Example 3
Source File: ElementAvailableCall.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Force the argument to this function to be a literal string.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (argument() instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                "element-available", this);
    throw new TypeCheckError(err);
}
 
Example 4
Source File: FunctionAvailableCall.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Argument of function-available call must be literal, typecheck
 * returns the type of function-available to be boolean.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_type != null) {
       return _type;
    }
    if (_arg instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                    "function-available", this);
    throw new TypeCheckError(err);
}
 
Example 5
Source File: FunctionAvailableCall.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Argument of function-available call must be literal, typecheck
 * returns the type of function-available to be boolean.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_type != null) {
       return _type;
    }
    if (_arg instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                    "function-available", this);
    throw new TypeCheckError(err);
}
 
Example 6
Source File: FunctionAvailableCall.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Argument of function-available call must be literal, typecheck
 * returns the type of function-available to be boolean.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_type != null) {
       return _type;
    }
    if (_arg instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                    "function-available", this);
    throw new TypeCheckError(err);
}
 
Example 7
Source File: CastCall.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Type check the two parameters for this function
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    // Check that the function was passed exactly two arguments
    if (argumentCount() != 2) {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
                                              getName(), this));
    }

    // The first argument must be a literal String
    Expression exp = argument(0);
    if (exp instanceof LiteralExpr) {
        _className = ((LiteralExpr) exp).getValue();
        _type = Type.newObjectType(_className);
    }
    else {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                              getName(), this));
    }

     // Second argument must be of type reference or object
    _right = argument(1);
    Type tright = _right.typeCheck(stable);
    if (tright != Type.Reference &&
        tright instanceof ObjectType == false)
    {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                              tright, _type, this));
    }

    return _type;
}
 
Example 8
Source File: CastCall.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Type check the two parameters for this function
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    // Check that the function was passed exactly two arguments
    if (argumentCount() != 2) {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
                                              getName(), this));
    }

    // The first argument must be a literal String
    Expression exp = argument(0);
    if (exp instanceof LiteralExpr) {
        _className = ((LiteralExpr) exp).getValue();
        _type = Type.newObjectType(_className);
    }
    else {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                              getName(), this));
    }

     // Second argument must be of type reference or object
    _right = argument(1);
    Type tright = _right.typeCheck(stable);
    if (tright != Type.Reference &&
        tright instanceof ObjectType == false)
    {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                              tright, _type, this));
    }

    return _type;
}
 
Example 9
Source File: ElementAvailableCall.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Force the argument to this function to be a literal string.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (argument() instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                "element-available", this);
    throw new TypeCheckError(err);
}
 
Example 10
Source File: ElementAvailableCall.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Force the argument to this function to be a literal string.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (argument() instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                "element-available", this);
    throw new TypeCheckError(err);
}
 
Example 11
Source File: ElementAvailableCall.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Force the argument to this function to be a literal string.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (argument() instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                "element-available", this);
    throw new TypeCheckError(err);
}
 
Example 12
Source File: CastCall.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Type check the two parameters for this function
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    // Check that the function was passed exactly two arguments
    if (argumentCount() != 2) {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
                                              getName(), this));
    }

    // The first argument must be a literal String
    Expression exp = argument(0);
    if (exp instanceof LiteralExpr) {
        _className = ((LiteralExpr) exp).getValue();
        _type = Type.newObjectType(_className);
    }
    else {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                              getName(), this));
    }

     // Second argument must be of type reference or object
    _right = argument(1);
    Type tright = _right.typeCheck(stable);
    if (tright != Type.Reference &&
        tright instanceof ObjectType == false)
    {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                              tright, _type, this));
    }

    return _type;
}
 
Example 13
Source File: FunctionAvailableCall.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Argument of function-available call must be literal, typecheck
 * returns the type of function-available to be boolean.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_type != null) {
       return _type;
    }
    if (_arg instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                    "function-available", this);
    throw new TypeCheckError(err);
}
 
Example 14
Source File: CastCall.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Type check the two parameters for this function
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    // Check that the function was passed exactly two arguments
    if (argumentCount() != 2) {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
                                              getName(), this));
    }

    // The first argument must be a literal String
    Expression exp = argument(0);
    if (exp instanceof LiteralExpr) {
        _className = ((LiteralExpr) exp).getValue();
        _type = Type.newObjectType(_className);
    }
    else {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                              getName(), this));
    }

     // Second argument must be of type reference or object
    _right = argument(1);
    Type tright = _right.typeCheck(stable);
    if (tright != Type.Reference &&
        tright instanceof ObjectType == false)
    {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                              tright, _type, this));
    }

    return _type;
}
 
Example 15
Source File: ElementAvailableCall.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Force the argument to this function to be a literal string.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (argument() instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                "element-available", this);
    throw new TypeCheckError(err);
}
 
Example 16
Source File: FunctionAvailableCall.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Argument of function-available call must be literal, typecheck
 * returns the type of function-available to be boolean.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_type != null) {
       return _type;
    }
    if (_arg instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                    "function-available", this);
    throw new TypeCheckError(err);
}
 
Example 17
Source File: CastCall.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Type check the two parameters for this function
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    // Check that the function was passed exactly two arguments
    if (argumentCount() != 2) {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
                                              getName(), this));
    }

    // The first argument must be a literal String
    Expression exp = argument(0);
    if (exp instanceof LiteralExpr) {
        _className = ((LiteralExpr) exp).getValue();
        _type = Type.newObjectType(_className);
    }
    else {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                              getName(), this));
    }

     // Second argument must be of type reference or object
    _right = argument(1);
    Type tright = _right.typeCheck(stable);
    if (tright != Type.Reference &&
        tright instanceof ObjectType == false)
    {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                              tright, _type, this));
    }

    return _type;
}
 
Example 18
Source File: FunctionAvailableCall.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Argument of function-available call must be literal, typecheck
 * returns the type of function-available to be boolean.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_type != null) {
       return _type;
    }
    if (_arg instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                    "function-available", this);
    throw new TypeCheckError(err);
}
 
Example 19
Source File: FunctionAvailableCall.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Argument of function-available call must be literal, typecheck
 * returns the type of function-available to be boolean.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_type != null) {
       return _type;
    }
    if (_arg instanceof LiteralExpr) {
        return _type = Type.Boolean;
    }
    ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                    "function-available", this);
    throw new TypeCheckError(err);
}
 
Example 20
Source File: CastCall.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Type check the two parameters for this function
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    // Check that the function was passed exactly two arguments
    if (argumentCount() != 2) {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
                                              getName(), this));
    }

    // The first argument must be a literal String
    Expression exp = argument(0);
    if (exp instanceof LiteralExpr) {
        _className = ((LiteralExpr) exp).getValue();
        _type = Type.newObjectType(_className);
    }
    else {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
                                              getName(), this));
    }

     // Second argument must be of type reference or object
    _right = argument(1);
    Type tright = _right.typeCheck(stable);
    if (tright != Type.Reference &&
        tright instanceof ObjectType == false)
    {
        throw new TypeCheckError(new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                              tright, _type, this));
    }

    return _type;
}