Examples of BytecodeValue


Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

        "  def getV():Int = this.testVal        \n"
        +   "val hello : Hello = Hello.make()         \n"
        +   "hello.setV(13)                  \n"
        +   "hello.getV()                  \n";
   
    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "13");
   
    String[] names = { "Hello" };
    BytecodeValue[] vals = { clasDef };
    assertTrue(isInContext(names,vals));   
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

        "   def getX():Int           \n"
        "     this.x                 \n"   
        " val tX : X = X.create()    \n"
        " tX.getX()                  \n";

    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "2");
   
    String[] names = { "X", "tX" };
    BytecodeValue[] vals = { clasDef, clas };
    assertTrue(isInContext(names,vals));
 
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

          "val c : X = X.create(1)        \n"
          "val a:Unit->Int = c.get            \n"
          "val b:Unit->Int = X.create(2).get  \n"
          "b() + a()                           \n";

    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "3")
   
    String[] names = { "X", "c", "a", "b" };
    BytecodeValue[] vals = { clasDef, clas, func, func };
    assertTrue(isInContext(names,vals));
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

        "   val z:Int = y                \n"
        "   def get():Int                \n"
        "      this.z                    \n"
        "X.create().get()                \n";

    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "16")
   
    String[] names = { "X", "y" };
    BytecodeValue[] vals = { clasDef, new BytecodeInt(16) };
    assertTrue(isInContext(names,vals));
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

    BytecodeRef dest;
    if(destExpr instanceof Inv) {
      Inv inv = (Inv) destExpr;
      BytecodeOperandVisitor opVisitor = new BytecodeOperandVisitor(context);
      BytecodeClass clas = (BytecodeClass) inv.getSource().accept(opVisitor);
      BytecodeValue val = clas.getContext().getValue(inv.getId());
      dest = (BytecodeRef) val;
    } else if(destExpr instanceof Immediate) {
      Immediate imm = (Immediate) destExpr;
      VarRef ref = (VarRef) imm.getInner();
      dest = (BytecodeRef) context.getValue(ref.getName());
    } else {
      throw new RuntimeException("assignment not using Inv or Imm");
    }
    BytecodeValue src = assign.getSrc().accept(visitor);
    dest.setValue(src);
    return context;
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

        "      this.z                    \n"
        "   class def create() : X       \n"
        "      new                       \n"
        "X.create().get()                \n";

    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "8");
   
    String[] names = { "X" };
    BytecodeValue[] vals = { clasDef };
    assertTrue(isInContext(names,vals));
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

   */
  @Override
  public BytecodeContext visit(Return aReturn) {
    interperter.endExecution();
    BytecodeOperandVisitor opVisitor = new BytecodeOperandVisitor(context);
    BytecodeValue val = aReturn.getExn().accept(opVisitor);
    interperter.setFinalVals(val, UNSAVED_MESSAGE);
    return context;
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

    return context;
  }

  @Override
  public BytecodeContext visit(IfStmt ifStmt) {
    BytecodeValue val = ifStmt.getCondition().accept(visitor);
    BytecodeBoolean bool = (BytecodeBoolean) val;
    if(bool.getValue()) {
      int id = ifStmt.getLabel().getIdx();
      int newPC = interperter.getLabelPC(id);
      interperter.setProgramCounter(newPC);
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

        +   "var z1 : Int = x1.increase()  \n"
        +   "val x2 : X = X.create()    \n"
        +   "var z2 : Int = x2.increase()  \n"
        +   "val z3 : Int = x2.increase()  \n";

    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "()")
   
    String[] names = { "X", "x1", "x2", "z1", "z2", "z3" };
    BytecodeInt nine = new BytecodeInt(9);
    BytecodeValue[] vals = { clasDef, clas, clas, nine, nine, new BytecodeInt(10) };
    assertTrue(isInContext(names,vals));
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

        +   "   class def make() : Y    \n"
        +   "     new            \n"
        +   "var x1 : X = X.make()      \n"
        +   "var y1 : Y = Y.make()      \n";

    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "()")
   
    String[] names = { "X", "Y", "x1", "y1" };
    BytecodeValue[] vals = { clasDef, clasDef, clas, clas };
    assertTrue(isInContext(names,vals));
  }
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.