Search in sources :

Example 6 with VarOrFieldDecl

use of org.abs_models.frontend.ast.VarOrFieldDecl in project abstools by abstools.

the class VarResolutionTest method testNestedLetExp4.

@Test
public void testNestedLetExp4() {
    Model m = assertParse(" def Bool f(Bool b) = let (Bool x) = b in let (Bool x) = b in x;");
    LetExp e = (LetExp) getFirstFunctionExpr(m);
    LetExp e2 = (LetExp) e.getExp();
    VarOrFieldDecl decl = e2.getVar();
    VarUse u = (VarUse) e2.getExp();
    assertEquals(decl, u.getDecl());
}
Also used : VarOrFieldDecl(org.abs_models.frontend.ast.VarOrFieldDecl) LetExp(org.abs_models.frontend.ast.LetExp) Model(org.abs_models.frontend.ast.Model) VarUse(org.abs_models.frontend.ast.VarUse) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Example 7 with VarOrFieldDecl

use of org.abs_models.frontend.ast.VarOrFieldDecl in project abstools by abstools.

the class VarResolutionTest method testLetExp.

@Test
public void testLetExp() {
    Model m = assertParse(" def Bool f(Bool b) = let (Bool x) = b in x;");
    LetExp e = (LetExp) getFirstFunctionExpr(m);
    VarOrFieldDecl decl = e.getVar();
    VarUse u = (VarUse) e.getExp();
    assertEquals(decl, u.getDecl());
}
Also used : VarOrFieldDecl(org.abs_models.frontend.ast.VarOrFieldDecl) LetExp(org.abs_models.frontend.ast.LetExp) Model(org.abs_models.frontend.ast.Model) VarUse(org.abs_models.frontend.ast.VarUse) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Example 8 with VarOrFieldDecl

use of org.abs_models.frontend.ast.VarOrFieldDecl in project abstools by abstools.

the class VarResolutionTest method testNestedLetExp.

@Test
public void testNestedLetExp() {
    Model m = assertParse(" def Bool f(Bool b) = let (Bool x) = let (Bool y) = b in y in x;");
    LetExp e = (LetExp) getFirstFunctionExpr(m);
    VarOrFieldDecl decl = e.getVar();
    VarUse u = (VarUse) e.getExp();
    assertEquals(decl, u.getDecl());
}
Also used : VarOrFieldDecl(org.abs_models.frontend.ast.VarOrFieldDecl) LetExp(org.abs_models.frontend.ast.LetExp) Model(org.abs_models.frontend.ast.Model) VarUse(org.abs_models.frontend.ast.VarUse) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Aggregations

VarOrFieldDecl (org.abs_models.frontend.ast.VarOrFieldDecl)8 LetExp (org.abs_models.frontend.ast.LetExp)7 VarUse (org.abs_models.frontend.ast.VarUse)7 FrontendTest (org.abs_models.frontend.FrontendTest)6 Model (org.abs_models.frontend.ast.Model)6 Test (org.junit.Test)6 TypedVarOrFieldDecl (org.abs_models.frontend.ast.TypedVarOrFieldDecl)2 TypeError (org.abs_models.frontend.analyser.TypeError)1 FieldDecl (org.abs_models.frontend.ast.FieldDecl)1 ParamDecl (org.abs_models.frontend.ast.ParamDecl)1 VarDecl (org.abs_models.frontend.ast.VarDecl)1