Package org.allspice.bytecode

Examples of org.allspice.bytecode.FieldRef


      Var x = new Var(1,new TypeName(type)) ;
      MethodDef md = new MethodDef(TypeName.VOID,"setFoo",x) ;
      md = md.addInstructions(
          new Load(new Var(0,new TypeName("TestClass"))),
          new Load(x),
          new Store(new FieldRef(cd.name,new TypeName(type),"foo")),
          new Return(TypeCode.VOID)
          ) ;
      cd = cd.addMethod(md) ;
    }
    {
      MethodDef md = new MethodDef(new TypeName(type),"getFoo") ;
      md = md.addInstructions(
          new Load(new Var(0,new TypeName("TestClass"))),
          new Load(new FieldRef(cd.name,new TypeName(type),"foo")),
          new Return(TypeCode.getType(type))
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
View Full Code Here


  private static LValue createLValue(EvaluationContext context, Expr e,String var,
      InstList l, FieldStub fd) throws CompilerException {
    if (!fd.isStatic) {
      context.compile(null,e, l) ;
      return new FieldRef(fd.cl.getTypeName(),fd.type.getTypeName(),var) ;
    }
    else {
      return new StaticFieldRef(fd.cl.getTypeName(),fd.type.getTypeName(),var) ;
    }
  }
View Full Code Here

    for(FieldStub fstub: stub.fields.values()) {
      if (fstub.isStatic) {
        vs = vs.addStaticFieldVar(new FIFO<StaticFieldRef>(new StaticFieldRef(stub.name,fstub.type.getTypeName(),fstub.nm))) ;
      }
      else {
        vs = vs.addFieldVar(new FIFO<FieldRef>(new FieldRef(stub.name,fstub.type.getTypeName(),fstub.nm))) ;
      }
    }
    return vs ;
  }
View Full Code Here

    case fieldref: {
      if (type == TypeCode.VOID) {
        ilc.add(InstructionConstants.POP) ;
      }
      else {
        FieldRef fdef = (FieldRef)lval;
        Type typ = TypeDefConverter.makeType(fdef.getType()) ;
        ilc.add(ilc.getInstructionFactory().createGetField(fdef.clazz.toString(), fdef.name, typ)) ;
      }
      break ;
    }
    case staticref: {
      if (type != TypeCode.VOID) {
        StaticFieldRef fdef = (StaticFieldRef)lval;
        Type typ = TypeDefConverter.makeType(fdef.getType()) ;
        ilc.add(ilc.getInstructionFactory().createGetStatic(fdef.clazz.toString(), fdef.name, typ)) ;
      }
      break ;
    }
    }
View Full Code Here

    case fieldref: {
      if (type == TypeCode.VOID) {
        ilc.add(InstructionConstants.POP) ;
      }
      else {
        FieldRef fdef = (FieldRef)lval ;
        Type typ = TypeDefConverter.makeType(fdef.getType()) ;
        ilc.add(ilc.getInstructionFactory().createPutField(fdef.clazz.toString(), fdef.name, typ)) ;
      }
      break ;
    }
    case staticref: {
      if (type != TypeCode.VOID) {       
        StaticFieldRef fdef = (StaticFieldRef)lval ;
        Type typ = TypeDefConverter.makeType(fdef.getType()) ;
        ilc.add(ilc.getInstructionFactory().createPutStatic(fdef.clazz.toString(), fdef.name, typ)) ;
      }
      break ;
    }
    }
View Full Code Here

TOP

Related Classes of org.allspice.bytecode.FieldRef

Copyright © 2018 www.massapicom. 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.