Package org.allspice.bytecode

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


      md = md.addInstructions(
          new Load(new Var(0,new TypeName("TestClass"))),
          new InvokeSpecial(mref),
          new Return(TypeCode.VOID)
      ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  public Class<?> makeClass(ClassDef cd) throws Exception {
    final JavaClass jc = GenJavaClass.createJavaClass(cd) ;
View Full Code Here


        new Return(TypeCode.BOOLEAN),
        new Nop(one),
        new Const(true),
        new Return(TypeCode.BOOLEAN)
        ) ;
    return cd.addMethod(md)
  }
  public void test1() throws Exception {
   
    ClassDef cd = defadd("double",1,3) ;
    Object obj = makeObject(cd) ;
View Full Code Here

          new Load(y),
          new Load(z),
          new Store(new ArrLValue(new TypeName(type))),
          new Return(TypeCode.VOID)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  public void test1() throws Exception {
    Class<?> obj = makeClass(defadd("int")) ;
View Full Code Here

        new Return(TypeCode.INT),
        new Nop(the_end),
        new Const(2),
        new Return(TypeCode.INT)
        ) ;
    cd = cd.addMethod(md)
    return cd ;
  }
  public void test1() throws Exception {
    ClassDef cd =  defadd() ;
    Object obj = makeObject(cd) ;
View Full Code Here

          new Load(x),
          new Store(y),
          new Load(y),
          new Return(TypeCode.getType(type))
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  public void test1() throws Exception {
   
View Full Code Here

    md = md.addInstructions(
        new Load(x),
        new Convert(TypeCode.getType(type),new TypeName(ret)),
        new Return(TypeCode.getType(ret))
        ) ;
    cd = cd.addMethod(md) ;
    return cd ;
  }
  public void test1() throws Exception {
    Object obj = makeObject(defadd("int","double")) ;
    Method m = obj.getClass().getMethod("meth",double.class) ;
View Full Code Here

      md = md.addInstructions(
          new Load(x),
          new ArrLen(),
          new Return(TypeCode.INT)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  public void test1() throws Exception {
    Class<?> obj = makeClass(defadd("int")) ;
View Full Code Here

          new New(new TypeName("java.lang.RuntimeException")),
          new org.allspice.bytecode.instructions.Dup(TypeCode.VOID,TypeCode.OBJECT),
          new InvokeSpecial(mref),
          new Throw()
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  public void test1() throws Exception {
   
View Full Code Here

        new Load(x),
        new Load(y),
        new Xor(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(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

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.