Search in sources :

Example 11 with FieldDecl

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

the class VarResolutionTest method testFieldUse.

@Test
public void testFieldUse() {
    Model m = assertParse(" class C { Bool f; Bool m() { return this.f; } }");
    ClassDecl d = (ClassDecl) getTestModule(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, ((FieldUse) s.getRetExp()).getDecl());
}
Also used : VarOrFieldDecl(org.abs_models.frontend.ast.VarOrFieldDecl) FieldDecl(org.abs_models.frontend.ast.FieldDecl) ClassDecl(org.abs_models.frontend.ast.ClassDecl) Model(org.abs_models.frontend.ast.Model) KindedName(org.abs_models.frontend.typechecker.KindedName) ReturnStmt(org.abs_models.frontend.ast.ReturnStmt) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Aggregations

FieldDecl (org.abs_models.frontend.ast.FieldDecl)11 ParamDecl (org.abs_models.frontend.ast.ParamDecl)6 FrontendTest (org.abs_models.frontend.FrontendTest)2 TypeError (org.abs_models.frontend.analyser.TypeError)2 ClassDecl (org.abs_models.frontend.ast.ClassDecl)2 Model (org.abs_models.frontend.ast.Model)2 ReturnStmt (org.abs_models.frontend.ast.ReturnStmt)2 TypedVarOrFieldDecl (org.abs_models.frontend.ast.TypedVarOrFieldDecl)2 VarOrFieldDecl (org.abs_models.frontend.ast.VarOrFieldDecl)2 KindedName (org.abs_models.frontend.typechecker.KindedName)2 Test (org.junit.Test)2 ABSDynamicClass (org.abs_models.backend.java.lib.runtime.ABSDynamicClass)1 ABSField (org.abs_models.backend.java.lib.runtime.ABSField)1 ABSValue (org.abs_models.backend.java.lib.types.ABSValue)1 FnApp (org.abs_models.frontend.ast.FnApp)1 FunctionDecl (org.abs_models.frontend.ast.FunctionDecl)1 GetExp (org.abs_models.frontend.ast.GetExp)1 MethodImpl (org.abs_models.frontend.ast.MethodImpl)1 PureExp (org.abs_models.frontend.ast.PureExp)1 VarOrFieldUse (org.abs_models.frontend.ast.VarOrFieldUse)1