Package com.google.test.metric

Examples of com.google.test.metric.Type


      return variables;
    }

    @Override
    public void visit(VariableDeclaration localVariableDeclaration) {
      Type variableType = CppType.fromName(localVariableDeclaration.getName(),
          localVariableDeclaration.isPointer());
      variables.add(new LocalVariableInfo(localVariableDeclaration.getName(),
          variableType));
    }
View Full Code Here


      }
      if (leftVar != null && rightVar != null) {
        Node leftParent = leftDeclaration.getParent();
        if (leftParent instanceof ClassDeclaration) {
          ClassInfo classInfo = repository.getClass(leftDeclaration.getName());
          Type fieldType = CppType.fromName(leftDeclaration.getType());
          FieldInfo fieldInfo = new FieldInfo(classInfo, leftDeclaration
              .getName(), fieldType, false, false, false);
          operations.add(new FieldAssignment(assignmentExpression
              .getLineNumber(), leftVar, fieldInfo, rightVar));
        } else {
View Full Code Here

  public FieldVisitorBuilder(ClassInfo classInfo, int access, String name,
      String desc, String signature, Object value) {
    boolean isStatic = (access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC;
    boolean isPrivate = JavaVisibility.valueFromJavaBytecode(access) == Visibility.PRIVATE;
    boolean isFinal = (access & Opcodes.ACC_FINAL) == Opcodes.ACC_FINAL;
    Type type = JavaType.fromDesc(desc);
    classInfo.addField(new FieldInfo(classInfo, name, type, isFinal,
        isStatic, isPrivate));
  }
View Full Code Here

    MethodCost cost = new MethodCost("", "void translation_unit()", 1, false, false, false);
    assertEquals("void translation_unit()", cost.getDescription());
  }

  public void testVariableFormatting() throws Exception {
    Type type = JavaType.fromJava("com.google.test.metric.example.MutableGlobalState." +
        "FinalGlobalExample$Gadget");
    FieldInfo field = new FieldInfo(null, "finalInstance", type, false, false, false);
    LocalField localField = new LocalField(new Variable(
        "com.google.test.metric.example.MutableGlobalState.FinalGlobalExample$" +
            "FinalGlobal.finalInstance",
View Full Code Here

  public void tryCatchBlock(Label start, final Label end, final Label handler,
      final String eType) {
    extraLinkSteps.add(new Runnable() {
      public void run() {
        Block handlerBlock = frames.get(handler).block;
        Type type = eType == null ? JavaType.fromClass(Throwable.class) : JavaType.fromJava(eType);
        handlerBlock.setExceptionHandler(-1, new Constant("?", type));
        exceptionHandlerBlocks.add(handlerBlock);
      }
    });
  }
View Full Code Here

    return dims;
  }

  @Override
  public List<Variable> apply(List<Variable> input) {
    Type array = clazz;
    for (int i = 0; i < dims; i++) {
      array = array.toArray();
    }
    return list(new Constant("?", array));
  }
View Full Code Here

    this.desc = desc;
    this.isFinal = isFinal;
    this.visibility = visibility;
    int slot = 0;
    if (!isStatic) {
      Type thisType = JavaType.fromJava(classInfo.getName());
      methodThis = new LocalVariableInfo("this", thisType);
      slots.put(slot++, methodThis);
      localVariables.add((LocalVariableInfo) methodThis);
    }
    for (Type type : parse(desc).getParameters()) {
View Full Code Here

    });
  }

  public void visitLocalVariable(String name, String desc, String signature,
      Label start, Label end, int slotNum) {
    Type type = JavaType.fromDesc(desc);
    Variable variable = slots.get(slotNum);
    if (variable == null) {
      LocalVariableInfo localVar = new LocalVariableInfo(name, type);
      slots.put(slotNum, localVar);
      localVariables.add(localVar);
View Full Code Here

  public void visitTypeInsn(final int opcode, final String desc) {
    if (desc.length() == 1) {
      throw new IllegalStateException(
          "WARNING! I don't expect primitive types:" + desc);
    }
    final Type type = desc.contains(";") ? JavaType.fromDesc(desc) : JavaType
        .fromJava(desc);
    recorder.add(new Runnable() {
      public void run() {
        switch (opcode) {
          case Opcodes.NEW :
            Constant constant = new Constant("new", type);
            block.addOp(new Load(lineNumber, constant));
            break;
          case Opcodes.NEWARRAY :
          case Opcodes.ANEWARRAY :
            block.addOp(new Transform(lineNumber, "newarray", JavaType.INT, null,
                type.toArray()));
            break;
          case Opcodes.INSTANCEOF :
            block.addOp(new Transform(lineNumber, "instanceof", JavaType.OBJECT,
                null, JavaType.INT));
            break;
View Full Code Here

      LocalVariableInfo localVar = new LocalVariableInfo("local_" + varIndex, type);
      slots.put(varIndex, localVar);
      localVariables.add(localVar);
      variable = localVar;
    }
    Type varType = variable.getType();
    if (!varType.equals(type) && (type.isPrimitive() || varType.isPrimitive())) {
      // Apparently the compiler reuses local variables and it is possible
      // that the types change. So if types change we have to drop
      // the variable and try again.
      slots.put(varIndex, null);
      return variable(varIndex, type);
View Full Code Here

TOP

Related Classes of com.google.test.metric.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.