Exemplo n.º 1
0
  public void writeMethod(MethodCall _methodCall, MethodEntry _methodEntry)
      throws CodeGenException {
    boolean noCL =
        _methodEntry
            .getOwnerClassModel()
            .getNoCLMethods()
            .contains(_methodEntry.getNameAndTypeEntry().getNameUTF8Entry().getUTF8());
    if (noCL) {
      return;
    }

    if (_methodCall instanceof VirtualMethodCall) {
      final Instruction instanceInstruction =
          ((VirtualMethodCall) _methodCall).getInstanceReference();
      if (!(instanceInstruction instanceof I_ALOAD_0)) {
        writeInstruction(instanceInstruction);
        write(".");
      } else {
        writeThisRef();
      }
    }
    final int argc = _methodEntry.getStackConsumeCount();
    write(_methodEntry.getNameAndTypeEntry().getNameUTF8Entry().getUTF8());
    write("(");

    for (int arg = 0; arg < argc; arg++) {
      if (arg != 0) {
        write(", ");
      }
      writeInstruction(_methodCall.getArg(arg));
    }
    write(")");
  }
 public void addMetodos(MethodEntry metodo) {
   this.metodos.add(metodo);
   metodo.setPai(this);
   this.tiposMetodos.insert(metodo.getNome(), metodo.getTipoDoRetorno());
 }