use of org.abs_models.frontend.ast.LetExp in project abstools by abstools.
the class VarResolutionTest method testNestedLetExp5.
@Test
public void testNestedLetExp5() {
Model m = assertParse("def Bool f(Bool b) = let (Bool x) = b in let (Bool x) = x in x;");
LetExp e = (LetExp) getFirstFunctionExpr(m);
LetExp e2 = (LetExp) e.getExp();
VarOrFieldDecl decl = e.getVar();
VarUse u = (VarUse) e2.getVal();
assertEquals(decl, u.getDecl());
}
use of org.abs_models.frontend.ast.LetExp in project abstools by abstools.
the class VarResolutionTest method testNestedLetExp2.
@Test
public void testNestedLetExp2() {
Model m = assertParse(" def Bool f(Bool b) = let (Bool x) = let (Bool x) = b in x in x;");
LetExp e = (LetExp) getFirstFunctionExpr(m);
VarOrFieldDecl decl = e.getVar();
VarUse u = (VarUse) e.getExp();
assertEquals(decl, u.getDecl());
}
use of org.abs_models.frontend.ast.LetExp in project abstools by abstools.
the class VarResolutionTest method testNestedLetExp3.
@Test
public void testNestedLetExp3() {
Model m = assertParse(" def Bool f(Bool b) = let (Bool x) = b in let (Bool y) = b in x;");
LetExp e = (LetExp) getFirstFunctionExpr(m);
LetExp e2 = (LetExp) e.getExp();
VarOrFieldDecl decl = e.getVar();
VarUse u = (VarUse) e2.getExp();
assertEquals(decl, u.getDecl());
}
use of org.abs_models.frontend.ast.LetExp in project abstools by abstools.
the class JavaGeneratorHelper method isLocalVarUse.
/**
* checks if astNode is a use of a local variable or parameter
*/
private static boolean isLocalVarUse(ASTNode<?> astNode) {
if (astNode instanceof VarUse) {
VarUse v = (VarUse) astNode;
VarOrFieldDecl decl = v.getDecl();
if (decl instanceof VarDecl || decl instanceof ParamDecl) {
return !(decl.getParent() instanceof LetExp);
}
}
return false;
}
use of org.abs_models.frontend.ast.LetExp 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());
}
Aggregations