Package wyil.lang

Examples of wyil.lang.Constant.type()


        String name = "constant$" + index;
        ArrayList<Modifier> fmods = new ArrayList<Modifier>();
        fmods.add(Modifier.ACC_PRIVATE);
        fmods.add(Modifier.ACC_STATIC);
        fmods.add(Modifier.ACC_FINAL);
        JvmType type = convertType(constant.type());
        ClassFile.Field field = new ClassFile.Field(name, type, fmods);
        cf.fields().add(field);

        // Now, create code to intialise this field
        translate(constant,0,lambdas,bytecodes);
View Full Code Here


  }

  private void translate(Codes.Const c, int freeSlot, HashMap<JvmConstant,Integer> constants,
      ArrayList<ClassFile> lambdas, ArrayList<Bytecode> bytecodes) {
    Constant constant = c.constant;
    JvmType jt = convertType(constant.type());

    if (constant instanceof Constant.Decimal || constant instanceof Constant.Bool
        || constant instanceof Constant.Null || constant instanceof Constant.Byte) {
      translate(constant,freeSlot,lambdas,bytecodes);
    } else {
View Full Code Here

      int id = JvmValue.get(constant,constants);
      String name = "constant$" + id;
      bytecodes.add(new Bytecode.GetField(owner, name, jt, Bytecode.FieldMode.STATIC));
      // the following is necessary to prevent in-place updates of our
      // constants!
      addIncRefs(constant.type(),bytecodes);
    }
    bytecodes.add(new Bytecode.Store(c.target(), jt));
  }

  private void translate(Codes.Convert c, int freeSlot,
View Full Code Here

        Constant value = p.first();
        String target = p.second();
        translate(value, freeSlot, lambdas, bytecodes);
        bytecodes
            .add(new Bytecode.Load(c.operand, convertType(c.type)));
        translateIfGoto(value.type(), Codes.Comparator.EQ, target, entry,
            freeSlot + 1, bytecodes);
      }
      bytecodes.add(new Bytecode.Goto(c.defaultTarget));
    }
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.