Package com.sun.org.apache.xalan.internal.xsltc.compiler.util

Examples of com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError


    public Type typeCheck(SymbolTable stable) throws TypeCheckError {
        // At least one argument - two at most
        final int ac = argumentCount();
        if ((ac < 1) || (ac > 2)) {
            ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, this);
            throw new TypeCheckError(msg);
        }
        if (getStylesheet() == null) {
            ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, this);
            throw new TypeCheckError(msg);
        }

        // Parse the first argument
        _arg1 = argument(0);

        if (_arg1 == null) {// should not happened
            ErrorMsg msg = new ErrorMsg(ErrorMsg.DOCUMENT_ARG_ERR, this);
            throw new TypeCheckError(msg);
        }

        _arg1Type = _arg1.typeCheck(stable);
        if ((_arg1Type != Type.NodeSet) && (_arg1Type != Type.String)) {
            _arg1 = new CastExpr(_arg1, Type.String);
        }

        // Parse the second argument
        if (ac == 2) {
            _arg2 = argument(1);

            if (_arg2 == null) {// should not happened
                ErrorMsg msg = new ErrorMsg(ErrorMsg.DOCUMENT_ARG_ERR, this);
                throw new TypeCheckError(msg);
            }

            final Type arg2Type = _arg2.typeCheck(stable);

            if (arg2Type.identicalTo(Type.Node)) {
                _arg2 = new CastExpr(_arg2, Type.NodeSet);
            } else if (arg2Type.identicalTo(Type.NodeSet)) {
                // falls through
            } else {
                ErrorMsg msg = new ErrorMsg(ErrorMsg.DOCUMENT_ARG_ERR, this);
                throw new TypeCheckError(msg);
            }
        }

        return _type = Type.NodeSet;
    }
View Full Code Here


      }
      if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
    typeCheckContents(stable); // with-params
    return Type.Void;
      }
      throw new TypeCheckError(this);
  }
  else {
      typeCheckContents(stable);    // with-params
      return Type.Void;
  }
View Full Code Here

  }
  if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
      typeCheckContents(stable);
      return Type.Void;
  }
  throw new TypeCheckError(this);
    }
View Full Code Here

      */
      else if (ftype instanceof NodeType)  {
    _filterExpr = new CastExpr(_filterExpr, Type.NodeSet);
      }
      else {
    throw new TypeCheckError(this);
      }
  }

  // Wrap single node path in a node set
  final Type ptype = _path.typeCheck(stable);
View Full Code Here

            break;
        case 1:
            _paramType = _param.typeCheck(stable);
            break;
        default:
            throw new TypeCheckError(this);
        }

        // The argument has to be a node, a node-set or a node reference
        if ((_paramType != Type.NodeSet) &&
            (_paramType != Type.Node) &&
            (_paramType != Type.Reference)) {
            throw new TypeCheckError(this);
        }

        return (_type = Type.String);
    }
View Full Code Here

                                        name, this);
        }
        if ((_ref = resolve(getParser(), stable)) != null) {
            return (_type = _ref.typeCheck(stable));
        }
        throw new TypeCheckError(reportError());
    }
View Full Code Here

            if (!arg2.identicalTo(tright))
                _right = new CastExpr(_right, arg1);
            // Return the result type for the operator we will use
            return _type = haveType.resultType();
        }
        throw new TypeCheckError(this);
    }
View Full Code Here

      if (!arg2.identicalTo(tright)) {
    _right = new CastExpr(_right, arg1);       
      }
      return _type = ptype.resultType();
  }
  throw new TypeCheckError(this);
    }
View Full Code Here

  if (ptype instanceof NodeSetType == false) {
      if (ptype instanceof ReferenceType)  {
    _primary = new CastExpr(_primary, Type.NodeSet);
      }
      else {
    throw new TypeCheckError(this);
      }
  }

        // Type check predicates and turn all optimizations off
  int n = _predicates.size();
View Full Code Here

     * 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;
    }
View Full Code Here

TOP

Related Classes of com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.