Example #1
0
  public Block initializeVariable(LocalVariableDefinition variable) {
    ParameterizedType type = variable.getType();
    if (type.getType().length() == 1) {
      switch (type.getType().charAt(0)) {
        case 'B':
        case 'Z':
        case 'S':
        case 'C':
        case 'I':
          nodes.add(loadInt(0));
          break;
        case 'F':
          nodes.add(loadFloat(0));
          break;
        case 'D':
          nodes.add(loadDouble(0));
          break;
        case 'J':
          nodes.add(loadLong(0));
          break;
        default:
          checkArgument(false, "Unknown type '%s'", variable.getType());
      }
    } else {
      nodes.add(Constant.loadNull());
    }

    nodes.add(VariableInstruction.storeVariable(variable));

    return this;
  }
Example #2
0
 public Block putVariable(LocalVariableDefinition variable, String value) {
   nodes.add(Constant.loadString(value));
   putVariable(variable);
   return this;
 }
Example #3
0
 public Block putVariable(String name, String value) {
   nodes.add(Constant.loadString(value));
   putVariable(name);
   return this;
 }
Example #4
0
 public Block push(String value) {
   nodes.add(Constant.loadString(value));
   return this;
 }