Package org.allspice.bytecode

Examples of org.allspice.bytecode.ClassDef.addMethod()


        new Load(x),
        new Load(y),
        new Remainder(TypeCode.getType(type)),
        new Return(TypeCode.getType(ret))
        ) ;
    return cd.addMethod(md)
  }
  public void test1() throws Exception {
   
    ClassDef cd = defadd("double","double",1,3) ;
    Object obj = makeObject(cd) ;
View Full Code Here


        new Load(x),
        new Load(y),
        new Multiply(TypeCode.getType(type)),
        new Return(TypeCode.getType(ret))
        ) ;
    return cd.addMethod(md)
  }
  public void test1() throws Exception {
   
    ClassDef cd = defadd("double","double",1,3) ;
    Object obj = makeObject(cd) ;
View Full Code Here

        new Load(x),
        new Load(y),
        new UnsignedShiftRight(TypeCode.getType(type)),
        new Return(TypeCode.getType(ret))
        ) ;
    return cd.addMethod(md)
  }
  public void test2() throws Exception {
   
    ClassDef cd = defadd("long","long",1,3) ;
    Object obj = makeObject(cd) ;
View Full Code Here

          new Load(y),
          new Add(TypeCode.INT),
          new Return(TypeCode.INT)
      ) ;
      // Watch it!  ClassDef is immutable
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  public static void main(String[] args) throws Exception {
    // Create the java class
View Full Code Here

          try {
            MethodDef def = getDef(converter,classPool,cdecl,mdd,fuinfo,fdcls,errors);
            if (def.name.equals("<init>")) {
              foundInit = true ;
            }
            cd = cd.addMethod(def) ;
          } catch (CompilerException e) {
            errors.add(e) ;
          }
        }
        else if (fom instanceof FieldDecl) {
View Full Code Here

      MethodDecl clinit = new MethodDecl(fa,"void","<clinit>",new FIFO<VarDecl>(),new FIFO<String>(),body) ;
      if (!foundInit && cdecl.classType != ClassType.INTERFACE) {
        FieldAttrs ifa = new FieldAttrs().setVisibility(Visibility.PUBLIC) ;
        MethodDecl mdd = new MethodDecl(ifa,"void","<init>",new FIFO<VarDecl>(),new FIFO<String>(),new FIFO<Statement>()) ;
        try {
          cd = cd.addMethod(getDef(converter,classPool,cdecl,mdd,fuinfo,fdcls,errors)) ;
        } catch (CompilerException e) {
          errors.add(e) ;
        }
      }
      {
View Full Code Here

          errors.add(e) ;
        }
      }
      {
        try {
          cd = cd.addMethod(getDef(converter,classPool,cdecl,clinit,fuinfo,fdcls,errors)) ;
        } catch (CompilerException e) {
          errors.add(e) ;
        }
      }
      defs.add(cd) ;
View Full Code Here

          new Load(new Var(0,new TypeName("TestClass"))),
          new InvokeSpecial(new MethodRef(cd.superClass,TypeName.VOID,"<init>")),
          new Return(TypeCode.VOID)
      ) ;
      // Watch it!  ClassDef is immutable
      cd = cd.addMethod(md) ;
    }
    {
      // Two variables, x & y
      // Index 0 is "this"
      Var x = new Var(1,TypeName.INT) ; // index 1
View Full Code Here

        new Load(x),
        new Load(y),
        new ShiftLeft(TypeCode.getType(type)),
        new Return(TypeCode.getType(ret))
        ) ;
    return cd.addMethod(md)
  }
  public void test2() throws Exception {
   
    ClassDef cd = defadd("long","long",1,3) ;
    Object obj = makeObject(cd) ;
View Full Code Here

      md = md.addInstructions(
          new Const(10),
          new New(new TypeName(type),1),
          new Return(TypeCode.ARRAY)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  public void test1() throws Exception {
   
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.