public void compile(ApplyExp paramApplyExp, Compilation paramCompilation, Target paramTarget) {
   paramCompilation.getCode();
   paramApplyExp = paramApplyExp.getArgs();
   int j = paramApplyExp.length;
   int i;
   if (((this.blockTarget instanceof IgnoreTarget))
       || ((this.blockTarget instanceof ConsumerTarget))) {
     i = 1;
     if (i == 0) {
       break label90;
     }
   }
   for (; ; ) {
     if ((i == 0) && (j != 1)) {
       break label98;
     }
     i = 0;
     while (i < j) {
       paramApplyExp[i].compileWithPosition(paramCompilation, this.blockTarget);
       i += 1;
     }
     i = 0;
     break;
     label90:
     paramTarget.getType();
   }
   label98:
   paramTarget = AppendValues.appendValues;
   paramTarget.compile(
       new ApplyExp(paramTarget, paramApplyExp), paramCompilation, this.blockTarget);
   this.exitableBlock.exit();
 }
 protected void emitCoerceOrNullMethod(Variable variable, Compilation compilation) {
   compilation = compilation.getCode();
   if (variable != null) {
     compilation.emitLoad(variable);
   }
   compilation.emitPushString(target);
   compilation.emitInvokeStatic(coerceOrNullMethod);
 }
  public void compile(ApplyExp applyexp, Compilation compilation, Target target) {
    Expression aexpression[] = applyexp.getArgs();
    CodeAttr codeattr = compilation.getCode();
    codeattr.pushScope();
    gnu.bytecode.Variable variable = codeattr.addLocal(Type.pointer_type);
    aexpression[0].compile(compilation, Target.pushObject);
    codeattr.emitStore(variable);
    for (int i = 1; i < aexpression.length; ) {
      if (i > 1) {
        codeattr.emitElse();
      }
      int k = i + 1;
      applyexp = aexpression[i];
      if (applyexp instanceof LambdaExp) {
        LambdaExp lambdaexp = (LambdaExp) applyexp;
        applyexp = lambdaexp.firstDecl();
        Type type = applyexp.getType();
        if (!applyexp.getCanRead()) {
          applyexp = null;
        } else {
          applyexp.allocateVariable(codeattr);
        }
        if (type instanceof TypeValue) {
          ((TypeValue) type).emitTestIf(variable, applyexp, compilation);
        } else {
          if (k < aexpression.length) {
            codeattr.emitLoad(variable);
            type.emitIsInstance(codeattr);
            codeattr.emitIfIntNotZero();
          }
          if (applyexp != null) {
            codeattr.emitLoad(variable);
            applyexp.compileStore(compilation);
          }
        }
        lambdaexp.allocChildClasses(compilation);
        lambdaexp.body.compileWithPosition(compilation, target);
        i = k;
      } else {
        throw new Error("not implemented: typeswitch arg not LambdaExp");
      }
    }

    int j = aexpression.length - 2;
    do {
      j--;
      if (j >= 0) {
        codeattr.emitFi();
      } else {
        codeattr.popScope();
        return;
      }
    } while (true);
  }
示例#4
0
 public void emitTestIf(Variable incoming, Declaration decl, Compilation comp) {
   CodeAttr code = comp.getCode();
   if (incoming != null) code.emitLoad(incoming);
   if (decl != null) {
     code.emitDup();
     decl.compileStore(comp);
   }
   comp.compileConstant(this);
   code.emitSwap();
   code.emitInvokeVirtual(isInstanceMethod);
   code.emitIfIntNotZero();
 }