use of org.abs_models.frontend.ast.ClassDecl in project abstools by abstools.
the class AnnotationTests method testFieldDecl.
@Test
public void testFieldDecl() {
Model m = assertParseOkAnn("class C { [Far] I i; }");
ClassDecl decl = getFirstClassDecl(m);
assertHasLocAnnotation(decl.getField(0).getType(), "Far");
}
use of org.abs_models.frontend.ast.ClassDecl in project abstools by abstools.
the class AnnotationTests method testMethodParam.
@Test
public void testMethodParam() {
Model m = assertParseOkAnn("class C { Unit m([Far] I i) { } }");
ClassDecl decl = getFirstClassDecl(m);
assertHasLocAnnotation(decl.getMethod(0).getMethodSig().getParam(0).getType(), "Far");
}
use of org.abs_models.frontend.ast.ClassDecl in project abstools by abstools.
the class AnnotationTests method testClassParam.
@Test
public void testClassParam() {
Model m = assertParseOkAnn("class C([Far] I i) { }");
ClassDecl decl = getFirstClassDecl(m);
assertHasLocAnnotation(decl.getParam(0).getType(), "Far");
}
use of org.abs_models.frontend.ast.ClassDecl in project abstools by abstools.
the class TypingTest method testFieldUse.
@Test
public void testFieldUse() {
Model m = assertParse(" class C { Bool f; Bool m() { return this.f; } }");
ClassDecl d = (ClassDecl) m.lookup(new KindedName(KindedName.Kind.CLASS, "UnitTest.C"));
FieldDecl f = d.getField(0);
ReturnStmt s = (ReturnStmt) d.getMethod(0).getBlock().getStmt(0);
assertEquals(f.getType(), s.getRetExp().getType());
}
use of org.abs_models.frontend.ast.ClassDecl in project abstools by abstools.
the class TypingTest method testContextDecl.
@Test
public void testContextDecl() {
Model m = assertParse("class C implements I { I m() { return this; } } interface I { }");
ClassDecl d = (ClassDecl) m.lookup(new KindedName(KindedName.Kind.CLASS, "C"));
ReturnStmt s = (ReturnStmt) d.getMethod(0).getBlock().getStmt(0);
assertEquals(d, s.getRetExp().getContextDecl());
}
Aggregations