use of abs.frontend.ast.Exp in project abstools by abstools.
the class FreeVarTest method letExp.
@Test
public void letExp() {
Exp e = getSecondExp("{ Bool b = True; Bool c = let (Bool d) = True in b; }");
assertEquals(e.getFreeVars(), "b");
}
use of abs.frontend.ast.Exp in project abstools by abstools.
the class FreeVarTest method constructorApp.
@Test
public void constructorApp() {
Exp e = getSecondExp("data D = C(Bool);{ Bool b; D d = C(b); }");
assertEquals(e.getFreeVars(), "b");
}
use of abs.frontend.ast.Exp in project abstools by abstools.
the class FreeVarTest method fieldUse.
@Test
public void fieldUse() {
ClassDecl clazz = getFirstClassDecl(assertParseOkStdLib("class C {" + "Int i = 0;" + "Int m() {" + "return i + 1;" + "}" + "}"));
MethodImpl method = clazz.lookupMethod("m");
assertNotNull(method);
Stmt stmt = method.getBlock().getStmt(0);
assertTrue(stmt instanceof ReturnStmt);
ReturnStmt returnStmt = (ReturnStmt) stmt;
Exp exp = returnStmt.getRetExp();
assertEquals(exp.getFreeVars(), "i");
}
use of abs.frontend.ast.Exp in project abstools by abstools.
the class FreeVarTest method parFnAppAnonymousFunction.
@Test
public void parFnAppAnonymousFunction() {
Exp e = getSecondExp("def Bool f(g)() = g(); { Bool b = True; Bool b2 = f(() => b)(); }");
assertEquals(e.getFreeVars(), "b");
}
use of abs.frontend.ast.Exp in project abstools by abstools.
the class FreeVarTest method callExp.
@Test
public void callExp() {
Exp e = getExp("interface I { Unit m(Bool b); } { Bool b = True; I i; Bool c = i.m(b); }", 2);
assertEquals(e.getFreeVars(), "i", "b");
}
Aggregations