Package org.apache.xalan.xsltc.compiler.util

Examples of org.apache.xalan.xsltc.compiler.util.Type


      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

  // 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

  return _type = Type.String;
    }

    public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
  final InstructionList il = methodGen.getInstructionList();
  Type targ;

  if (argumentCount() == 0) {
      il.append(methodGen.loadContextNode());
      targ = Type.Node;
  }
  else {
      final Expression arg = argument();
      arg.translate(classGen, methodGen);
      arg.startIterator(classGen, methodGen);
      targ = arg.getType();
  }

  if (!targ.identicalTo(Type.String)) {
      targ.translateTo(classGen, methodGen, Type.String);
  }
    }
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

TOP

Related Classes of org.apache.xalan.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.