Examples of FieldVarExpr


Examples of org.allspice.structured.expr.FieldVarExpr

public class TestSetField extends MyTestCase {
  public static interface BooleanSetFieldTest {
    public void meth(FieldTestClass arg0,boolean arg1) ;
  }
  public void test0() throws Exception {
    Statement st = new ExprStatement(new SetValueExpr(new FieldVarExpr(ARG0,"boolean_field",null),ARG1,null),null) ;
    BooleanSetFieldTest obj = makeObject(BooleanSetFieldTest.class,st,new ReturnStatement(null)) ;
    FieldTestClass o2 = new FieldTestClass() ;
    obj.meth(o2, true) ;
    assertEquals(o2.boolean_field,true) ;
    obj.meth(o2, false) ;
View Full Code Here

Examples of org.allspice.structured.expr.FieldVarExpr

  }
  public static interface ByteSetFieldTest {
    public void meth(FieldTestClass arg0,byte arg1) ;
  }
  public void test1() throws Exception {
    Statement st = new ExprStatement(new SetValueExpr(new FieldVarExpr(ARG0,"byte_field",null),ARG1,null),null) ;
    ByteSetFieldTest obj = makeObject(ByteSetFieldTest.class,st,new ReturnStatement(null)) ;
    FieldTestClass o2 = new FieldTestClass() ;
    obj.meth(o2, (byte)45) ;
    assertEquals(o2.byte_field,(byte)45) ;
  }
View Full Code Here

Examples of org.allspice.structured.expr.FieldVarExpr

  public static Expr makeFCall(PositionRange range,Expr factor,ImmutableCollection<Expr> elist_opt) {
      final Expr v ;
    if (factor instanceof VarExpr) {
      VarExpr ve = (VarExpr)factor ;
      if (ve.var.equals("this")) {
        v = new FieldVarExpr(ve,"<init>",range) ;
      }
      else if (ve.var.equals("super")) {
        v = new FieldVarExpr(ve,"<init>",range) ;
      }
      else {
        v = factor ;
      }
    }
View Full Code Here

Examples of org.allspice.structured.expr.FieldVarExpr

          }
        }
        else if (fom instanceof FieldDecl) {
          FieldDecl fdecl = (FieldDecl)fom ;
          if (fdecl.fieldAttrs.isStatic && fdecl.intializer != null) {
            SetValueExpr se = new SetValueExpr(new FieldVarExpr(cname.toString(),fdecl.name,null),fdecl.intializer,null) ;
            body = body.insert(new ExprStatement(se,null)) ;         
          }
        }
      }
      MethodDecl clinit = new MethodDecl(fa,"void","<clinit>",new FIFO<VarDecl>(),new FIFO<String>(),body) ;
View Full Code Here

Examples of org.allspice.structured.expr.FieldVarExpr

  private static void modifyConstructor(EvaluationContext context,
      final ArrayList<Statement> body) throws CompilerException {
    boolean foundInit = firstIsSuperInit(body);
    if (!foundInit) {
      body.add(0,new ExprStatement(new CallExpr(new FieldVarExpr(new VarExpr("super",null),"<init>",null),new FIFO<Expr>(),null),null)) ;
    }
    StubResolver resolver = context.classDef ;
    int pos = 1 ;
    ClassStub stub = resolver.getStub() ;
    for(FieldStub def: stub.fields.values()) {
      if (!def.isStatic) {
        if (def.initializer != null) {
          SetValueExpr se = new SetValueExpr(new FieldVarExpr(new VarExpr("this",null),def.nm,null),def.initializer,null) ;
          body.add(pos++,new ExprStatement(se,null)) ;
        }
      }
    }
  }
View Full Code Here

Examples of org.allspice.structured.expr.FieldVarExpr

        Expr e = es.e ;
        if (e instanceof CallExpr) {
          CallExpr ce = (CallExpr)e ;
          Expr ve = ce.object ;
          if (ve instanceof FieldVarExpr) {
            FieldVarExpr fvar = (FieldVarExpr)ve ;
            if (fvar.name.equals("<init>")) {
              return true ;
            }
          }
          else if (ve instanceof VarExpr) {
View Full Code Here

Examples of org.allspice.structured.expr.FieldVarExpr

  public static MethodInvocation createMethDef(EvaluationContext context, final Collection<Expr> args, Expr fld) throws CompilerException, UndefinedMethod {
    StubResolver type ;
    String name ;
    boolean issuper = false ;
    if (fld instanceof FieldVarExpr) {
      final FieldVarExpr fve = (FieldVarExpr)fld;
      type = getClassReference(context, fve.object) ;
      if (fve.object instanceof VarExpr) {
        VarExpr ve = (VarExpr)fve.object ;
        issuper = ve.var.equals("super") ;
      }
View Full Code Here

Examples of org.allspice.structured.expr.FieldVarExpr

        return context.fullyQualified(decl) ;
      }
      return null ;
    }
    else if (e instanceof FieldVarExpr) {
      FieldVarExpr fve = (FieldVarExpr)e ;
      Expr obj = fve.object ;
      String name = fve.name ;
      TypeName type = getClassName(context,obj);
      if (type == null) {
        return null ;
View Full Code Here

Examples of org.allspice.structured.expr.FieldVarExpr

  public static interface CallStaticTest {
    public int meth(int arg0) ;
  }
  public void test0() throws Exception {
    CallStaticTest obj = makeObject(CallStaticTest.class,new CallExpr(
        new FieldVarExpr("org.allspice.structuredtobc.test.TestCallStatic","addone",null),
        new FIFO<Expr>(ARG0),null)) ;
    assertEquals(obj.meth(5),6) ;
  }
View Full Code Here

Examples of org.allspice.structured.expr.FieldVarExpr

  public static interface BooleanSetFieldTest {
    public void meth(boolean arg1) ;
  }
  public void test0() throws Exception {
    Statement st = new ExprStatement(new SetValueExpr(
        new FieldVarExpr("org.allspice.structuredtobc.test.StaticFieldTestClass","boolean_field",null),ARG0,null),null) ;
    BooleanSetFieldTest obj = makeObject(BooleanSetFieldTest.class,st,new ReturnStatement(null)) ;
    obj.meth(true) ;
    assertEquals(StaticFieldTestClass.boolean_field,true) ;
    obj.meth(false) ;
    assertEquals(StaticFieldTestClass.boolean_field,false) ;
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.