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

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


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


      return;
        }
    }
 
    public Type typeCheck(SymbolTable stable) throws TypeCheckError {
  final Type tselect = _select.typeCheck(stable);
  if (tselect instanceof NodeType ||
      tselect instanceof NodeSetType ||
      tselect instanceof ReferenceType ||
      tselect instanceof ResultTreeType) {
      // falls through
View Full Code Here

    }
 
    public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();
  final Type tselect = _select.getType();

  final String CPY1_SIG = "("+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+")V";
  final int cpy1 = cpg.addInterfaceMethodref(DOM_INTF, "copy", CPY1_SIG);

  final String CPY2_SIG = "("+NODE_SIG+TRANSLET_OUTPUT_SIG+")V";
View Full Code Here

     * Type-check either the select attribute or the element body, depending
     * on which is in use.
     */
    public Type typeCheck(SymbolTable stable) throws TypeCheckError {
  if (_select != null) {
      final Type tselect = _select.typeCheck(stable);
      if (tselect instanceof ReferenceType == false) {
    _select = new CastExpr(_select, Type.Reference);
      }
  }
  else {
View Full Code Here

    /**
     * Type-check this expression, and possibly child expressions.
     */
    public Type typeCheck(SymbolTable stable) throws TypeCheckError {
  // Get the left and right operand types
  Type tleft = _left.typeCheck(stable);
  Type tright = _right.typeCheck(stable);

  // Check if the operator supports the two operand types
  MethodType wantType = new MethodType(Type.Void, tleft, tright);
  MethodType haveType = lookupPrimop(stable, Ops[_op], wantType);

  // Yes, the operation is supported
  if (haveType != null) {
      // Check if left-hand side operand must be type casted
      Type arg1 = (Type)haveType.argsType().elementAt(0);
      if (!arg1.identicalTo(tleft))
    _left = new CastExpr(_left, arg1);
      // Check if right-hand side operand must be type casted
      Type arg2 = (Type) haveType.argsType().elementAt(1);
      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

  // Get the sort data type; default is text
  val = getAttribute("data-type");
  if (val.length() == 0) {
      try {
    final Type type = _select.typeCheck(parser.getSymbolTable());
    if (type instanceof IntType)
        val = "number";
    else
        val = "text";
      }
View Full Code Here

    /**
     * Run type checks on the attributes; expression must return a string
     * which we will use as a sort key
     */
    public Type typeCheck(SymbolTable stable) throws TypeCheckError {
  final Type tselect = _select.typeCheck(stable);

  // If the sort data-type is not set we use the natural data-type
  // of the data we will sort
  if (!(tselect instanceof StringType)) {
      _select = new CastExpr(_select, Type.String);
View Full Code Here

  // Initialize closure in record class
  final int ndups = dups.size();
  for (int i = 0; i < ndups; i++) {
      final VariableRefBase varRef = (VariableRefBase) dups.get(i);
      final VariableBase var = varRef.getVariable();
      final Type varType = var.getType();
     
      il.append(DUP);

      // Get field from factory class
      il.append(ALOAD_0);
      il.append(new GETFIELD(
    cpg.addFieldref(className,
        var.getEscapedName(), varType.toSignature())));

      // Put field in record class
      il.append(new PUTFIELD(
    cpg.addFieldref(sortRecordClass,
        var.getEscapedName(), varType.toSignature())));
  }
  il.append(POP);
  il.append(ARETURN);

  constructor.setMaxLocals();
View Full Code Here

     * This method may be called twice, before and after calling
     * <code>dontOptimize()</code>. If so, the second time it should honor
     * the new value of <code>_canOptimize</code>.
     */
    public Type typeCheck(SymbolTable stable) throws TypeCheckError {
        Type texp = _exp.typeCheck(stable);

        // We need explicit type information for reference types - no good!
        if (texp instanceof ReferenceType) {
            _exp = new CastExpr(_exp, texp = Type.Real);
        }
View Full Code Here

        final int length = (_closureVars == null) ? 0 : _closureVars.size();

        for (int i = 0; i < length; i++) {
            VariableRefBase varRef = (VariableRefBase) _closureVars.get(i);
            VariableBase var = varRef.getVariable();
            Type varType = var.getType();

            il.append(DUP);

            // Find nearest closure implemented as an inner class
            Closure variableClosure = _parentClosure;
            while (variableClosure != null) {
                if (variableClosure.inInnerClass()) break;
                variableClosure = variableClosure.getParentClosure();
            }

            // Use getfield if in an inner class
            if (variableClosure != null) {
                il.append(ALOAD_0);
                il.append(new GETFIELD(
                    cpg.addFieldref(variableClosure.getInnerClassName(),
                        var.getEscapedName(), varType.toSignature())));
            }
            else {
                // Use a load of instruction if in translet class
                il.append(var.loadInstruction());
            }

            // Store variable in new closure
            il.append(new PUTFIELD(
                    cpg.addFieldref(_className, var.getEscapedName(),
                        varType.toSignature())));
        }
    }
View Full Code Here

TOP

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

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.