Search in sources :

Example 11 with SkipStmt

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

the class TraitTest method addRemoveModifyMethod.

@Test
public void addRemoveModifyMethod() {
    Model model = assertParse("module M;" + "trait T = {Unit myMethod(){ println(\"\"); }} " + "trait T3 = T modifies { Unit myMethod(){ skip; }} " + "class C { uses T3;  }");
    ClassDecl cls = (ClassDecl) findDecl(model, "M", "C");
    assertNotNull(cls);
    assertTrue(cls.getMethods().getNumChild() == 0);
    model.applyTraits();
    assertTrue(cls.getMethods().getNumChild() == 1);
    assertTrue(cls.getMethod(0).getBlock().getStmt(0) instanceof SkipStmt);
}
Also used : ClassDecl(org.abs_models.frontend.ast.ClassDecl) Model(org.abs_models.frontend.ast.Model) SkipStmt(org.abs_models.frontend.ast.SkipStmt) Test(org.junit.Test)

Aggregations

ClassDecl (org.abs_models.frontend.ast.ClassDecl)11 Model (org.abs_models.frontend.ast.Model)11 SkipStmt (org.abs_models.frontend.ast.SkipStmt)11 Test (org.junit.Test)11 Block (org.abs_models.frontend.ast.Block)2 CompilationUnit (org.abs_models.frontend.ast.CompilationUnit)2 DeltaAccess (org.abs_models.frontend.ast.DeltaAccess)2 DeltaDecl (org.abs_models.frontend.ast.DeltaDecl)2 List (org.abs_models.frontend.ast.List)2 MethodImpl (org.abs_models.frontend.ast.MethodImpl)2 MethodSig (org.abs_models.frontend.ast.MethodSig)2 ModifyClassModifier (org.abs_models.frontend.ast.ModifyClassModifier)2 AddMethodModifier (org.abs_models.frontend.ast.AddMethodModifier)1 ModifyMethodModifier (org.abs_models.frontend.ast.ModifyMethodModifier)1