Examples of typeCheck()


Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

            "  class def create():Hello = new\n" +
            "  def foo():Int = 7\n" +
            "  val bar:Int = 19\n" +
            "Hello.create().foo()";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()), Int.getInstance());
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "IntegerConstant(7)");
  }

  @Test
  public void testClassMutual() throws IOException, CopperParserException {
View Full Code Here

Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

        "  class def create():Hello = new\n" +
        "  def foo():Foo = Foo.create()\n" +
        "  val bar:Int = 19\n" +
        "Hello.create().bar";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()), Int.getInstance());
    Assert.assertEquals("IntegerConstant(19)", res.evaluate(Globals.getStandardEnv()).toString());
  }

  @Test
  public void parseSimpleClass() throws IOException, CopperParserException {
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.