use of org.abs_models.frontend.ast.PatternVarDecl in project abstools by abstools.
the class VarResolutionTest method testNestedPatternVar.
@Test
public void testNestedPatternVar() {
Model m = assertParse("data Foo = Bar(Bool); def Bool m(Foo f) = case f { Bar(y) => y; };");
assertThat(getFirstCaseExpr(m), instanceOf(VarUse.class));
ConstructorPattern p = (ConstructorPattern) getFirstCasePattern(m);
PatternVarDecl decl = ((PatternVar) p.getParam(0)).getVar();
assertEquals("y", decl.getName());
}
use of org.abs_models.frontend.ast.PatternVarDecl in project abstools by abstools.
the class VarResolutionTest method testPatternVar.
@Test
public void testPatternVar() {
Model m = assertParse(" def Bool f(Bool b) = case b { True => False; x => !x; };");
NegExp ne = (NegExp) getSecondCaseExpr(m);
VarUse v = (VarUse) ne.getOperand();
PatternVarDecl decl = (PatternVarDecl) v.getDecl();
assertEquals("x", decl.getName());
}
Aggregations