private String toTypeUse(Type type) {
    String typeUse = null;

    if (type instanceof ArrayType) {
      ArrayType at = (ArrayType) type;
      typeUse = "";
      int dims = at.getDimensions();
      for (int i = 0; i < dims; i++) {
        typeUse = typeUse.concat("[]");
      }
    } // end if

    return typeUse;
  }
示例#2
0
 public void outAFullIdentNonvoidType(AFullIdentNonvoidType node) {
   String typeName = (String) mProductions.removeLast();
   Type t = RefType.v(typeName);
   int dim = node.getArrayBrackets().size();
   if (dim > 0) t = ArrayType.v(t, dim);
   mProductions.addLast(t);
 }
  private DbOOAdt toAdt(Type type) throws DbException {
    DbOOAdt adt = null;

    if (type instanceof BasicType) {
      BasicType basicType = (BasicType) type;
      adt = toBasicAdt(basicType);
    } else if (type instanceof ObjectType) {
      ObjectType ot = (ObjectType) type;
      String classname = ot.getClassName();
      adt = toAdt(classname, ot);
    } else if (type instanceof ArrayType) {
      ArrayType at = (ArrayType) type;
      adt = toAdt(at.getBasicType());
    } else {
      // other cases?
    } // end if

    return adt;
  }
示例#4
0
  public void outAMultiNewExpr(AMultiNewExpr node) {

    LinkedList arrayDesc = node.getArrayDescriptor();

    int descCnt = arrayDesc.size();
    List sizes = new LinkedList();

    Iterator it = arrayDesc.iterator();
    while (it.hasNext()) {
      AArrayDescriptor o = (AArrayDescriptor) it.next();
      if (o.getImmediate() != null) sizes.add(0, (Value) mProductions.removeLast());
      else break;
    }

    Type type = (Type) mProductions.removeLast();
    ArrayType arrayType = ArrayType.v(type, descCnt);

    mProductions.addLast(Jimple.v().newNewMultiArrayExpr(arrayType, sizes));
  }
示例#5
0
 /*
   nonvoid_type =
   {base}   base_type_no_name array_brackets*;
   {quoted} quoted_name array_brackets* |
   {ident}  identifier array_brackets* |
   {full_ident} full_identifier array_brackets*;
 */
 public void outABaseNonvoidType(ABaseNonvoidType node) {
   Type t = (Type) mProductions.removeLast();
   int dim = node.getArrayBrackets().size();
   if (dim > 0) t = ArrayType.v(t, dim);
   mProductions.addLast(t);
 }